summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2004-08-14 23:55:37 +1000
committerDarren Tucker <dtucker@zip.com.au>2004-08-14 23:55:37 +1000
commit066969339dcd0352965de0ab1b5f693cf2a7fee8 (patch)
treedf36cda53b0cb0050084516295cd1529e48f01ef
parenta763105c0f6e4d58f2e477597d1cf5ca5317b1a1 (diff)
- (dtucker) [auth-krb5.c gss-serv-krb5.c openbsd-compat/xmmap.c]
Explicitly set umask for mkstemp; ok djm@
-rw-r--r--ChangeLog6
-rw-r--r--auth-krb5.c6
-rw-r--r--gss-serv-krb5.c6
-rw-r--r--openbsd-compat/xmmap.c5
4 files changed, 19 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 98b0f8b96..3079c3881 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
120040814
2 - (dtucker) [auth-krb5.c gss-serv-krb5.c openbsd-compat/xmmap.c]
3 Explicitly set umask for mkstemp; ok djm@
4
120040813 520040813
2 - (dtucker) [openbsd-compat/bsd-misc.c] Typo in #ifdef; from vinschen at 6 - (dtucker) [openbsd-compat/bsd-misc.c] Typo in #ifdef; from vinschen at
3 redhat.com 7 redhat.com
@@ -1622,4 +1626,4 @@
1622 - (djm) Trim deprecated options from INSTALL. Mention UsePAM 1626 - (djm) Trim deprecated options from INSTALL. Mention UsePAM
1623 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu 1627 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
1624 1628
1625$Id: ChangeLog,v 1.3505 2004/08/13 11:30:24 dtucker Exp $ 1629$Id: ChangeLog,v 1.3506 2004/08/14 13:55:37 dtucker Exp $
diff --git a/auth-krb5.c b/auth-krb5.c
index a728ebac1..a324ff15c 100644
--- a/auth-krb5.c
+++ b/auth-krb5.c
@@ -69,6 +69,7 @@ auth_krb5_password(Authctxt *authctxt, const char *password)
69 krb5_principal server; 69 krb5_principal server;
70 char ccname[40]; 70 char ccname[40];
71 int tmpfd; 71 int tmpfd;
72 mode_t old_umask;
72#endif 73#endif
73 krb5_error_code problem; 74 krb5_error_code problem;
74 krb5_ccache ccache = NULL; 75 krb5_ccache ccache = NULL;
@@ -147,7 +148,10 @@ auth_krb5_password(Authctxt *authctxt, const char *password)
147 148
148 snprintf(ccname,sizeof(ccname),"FILE:/tmp/krb5cc_%d_XXXXXX",geteuid()); 149 snprintf(ccname,sizeof(ccname),"FILE:/tmp/krb5cc_%d_XXXXXX",geteuid());
149 150
150 if ((tmpfd = mkstemp(ccname+strlen("FILE:")))==-1) { 151 old_umask = umask(0177);
152 tmpfd = mkstemp(ccname + strlen("FILE:"));
153 umask(old_umask);
154 if (tmpfd == -1) {
151 logit("mkstemp(): %.100s", strerror(errno)); 155 logit("mkstemp(): %.100s", strerror(errno));
152 problem = errno; 156 problem = errno;
153 goto out; 157 goto out;
diff --git a/gss-serv-krb5.c b/gss-serv-krb5.c
index 6bd5830fb..91d87f798 100644
--- a/gss-serv-krb5.c
+++ b/gss-serv-krb5.c
@@ -134,11 +134,15 @@ ssh_gssapi_krb5_storecreds(ssh_gssapi_client *client)
134 { 134 {
135 int tmpfd; 135 int tmpfd;
136 char ccname[40]; 136 char ccname[40];
137 mode_t old_umask;
137 138
138 snprintf(ccname, sizeof(ccname), 139 snprintf(ccname, sizeof(ccname),
139 "FILE:/tmp/krb5cc_%d_XXXXXX", geteuid()); 140 "FILE:/tmp/krb5cc_%d_XXXXXX", geteuid());
140 141
141 if ((tmpfd = mkstemp(ccname + strlen("FILE:"))) == -1) { 142 old_umask = umask(0177);
143 tmpfd = mkstemp(ccname + strlen("FILE:"));
144 umask(old_umask);
145 if (tmpfd == -1) {
142 logit("mkstemp(): %.100s", strerror(errno)); 146 logit("mkstemp(): %.100s", strerror(errno));
143 problem = errno; 147 problem = errno;
144 return; 148 return;
diff --git a/openbsd-compat/xmmap.c b/openbsd-compat/xmmap.c
index f1a637a34..c8d59dee0 100644
--- a/openbsd-compat/xmmap.c
+++ b/openbsd-compat/xmmap.c
@@ -23,7 +23,7 @@
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26/* $Id: xmmap.c,v 1.4 2004/05/13 06:39:34 dtucker Exp $ */ 26/* $Id: xmmap.c,v 1.5 2004/08/14 13:55:38 dtucker Exp $ */
27 27
28#include "includes.h" 28#include "includes.h"
29 29
@@ -50,8 +50,11 @@ void *xmmap(size_t size)
50 if (address == MAP_FAILED) { 50 if (address == MAP_FAILED) {
51 char tmpname[sizeof(MM_SWAP_TEMPLATE)] = MM_SWAP_TEMPLATE; 51 char tmpname[sizeof(MM_SWAP_TEMPLATE)] = MM_SWAP_TEMPLATE;
52 int tmpfd; 52 int tmpfd;
53 mode_t old_umask;
53 54
55 old_umask = umask(0177);
54 tmpfd = mkstemp(tmpname); 56 tmpfd = mkstemp(tmpname);
57 umask(old_umask);
55 if (tmpfd == -1) 58 if (tmpfd == -1)
56 fatal("mkstemp(\"%s\"): %s", 59 fatal("mkstemp(\"%s\"): %s",
57 MM_SWAP_TEMPLATE, strerror(errno)); 60 MM_SWAP_TEMPLATE, strerror(errno));