Explicitly set umask for mkstemp; ok djm@
+20040814
+ - (dtucker) [auth-krb5.c gss-serv-krb5.c openbsd-compat/xmmap.c]
+ Explicitly set umask for mkstemp; ok djm@
+
20040813
- (dtucker) [openbsd-compat/bsd-misc.c] Typo in #ifdef; from vinschen at
redhat.com
20040813
- (dtucker) [openbsd-compat/bsd-misc.c] Typo in #ifdef; from vinschen at
redhat.com
krb5_principal server;
char ccname[40];
int tmpfd;
krb5_principal server;
char ccname[40];
int tmpfd;
#endif
krb5_error_code problem;
krb5_ccache ccache = NULL;
#endif
krb5_error_code problem;
krb5_ccache ccache = NULL;
snprintf(ccname,sizeof(ccname),"FILE:/tmp/krb5cc_%d_XXXXXX",geteuid());
snprintf(ccname,sizeof(ccname),"FILE:/tmp/krb5cc_%d_XXXXXX",geteuid());
- if ((tmpfd = mkstemp(ccname+strlen("FILE:")))==-1) {
+ old_umask = umask(0177);
+ tmpfd = mkstemp(ccname + strlen("FILE:"));
+ umask(old_umask);
+ if (tmpfd == -1) {
logit("mkstemp(): %.100s", strerror(errno));
problem = errno;
goto out;
logit("mkstemp(): %.100s", strerror(errno));
problem = errno;
goto out;
{
int tmpfd;
char ccname[40];
{
int tmpfd;
char ccname[40];
snprintf(ccname, sizeof(ccname),
"FILE:/tmp/krb5cc_%d_XXXXXX", geteuid());
snprintf(ccname, sizeof(ccname),
"FILE:/tmp/krb5cc_%d_XXXXXX", geteuid());
- if ((tmpfd = mkstemp(ccname + strlen("FILE:"))) == -1) {
+ old_umask = umask(0177);
+ tmpfd = mkstemp(ccname + strlen("FILE:"));
+ umask(old_umask);
+ if (tmpfd == -1) {
logit("mkstemp(): %.100s", strerror(errno));
problem = errno;
return;
logit("mkstemp(): %.100s", strerror(errno));
problem = errno;
return;
if (address == MAP_FAILED) {
char tmpname[sizeof(MM_SWAP_TEMPLATE)] = MM_SWAP_TEMPLATE;
int tmpfd;
if (address == MAP_FAILED) {
char tmpname[sizeof(MM_SWAP_TEMPLATE)] = MM_SWAP_TEMPLATE;
int tmpfd;
+ old_umask = umask(0177);
tmpfd = mkstemp(tmpname);
tmpfd = mkstemp(tmpname);
if (tmpfd == -1)
fatal("mkstemp(\"%s\"): %s",
MM_SWAP_TEMPLATE, strerror(errno));
if (tmpfd == -1)
fatal("mkstemp(\"%s\"): %s",
MM_SWAP_TEMPLATE, strerror(errno));