gss-serv-krb5.c (128456) | gss-serv-krb5.c (137015) |
---|---|
1/* $OpenBSD: gss-serv-krb5.c,v 1.2 2003/11/21 11:57:03 djm Exp $ */ | 1/* $OpenBSD: gss-serv-krb5.c,v 1.3 2004/07/21 10:36:23 djm Exp $ */ |
2 3/* 4 * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright --- 38 unchanged lines hidden (view full) --- 48# endif 49#endif 50 51static krb5_context krb_context = NULL; 52 53/* Initialise the krb5 library, for the stuff that GSSAPI won't do */ 54 55static int | 2 3/* 4 * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright --- 38 unchanged lines hidden (view full) --- 48# endif 49#endif 50 51static krb5_context krb_context = NULL; 52 53/* Initialise the krb5 library, for the stuff that GSSAPI won't do */ 54 55static int |
56ssh_gssapi_krb5_init() | 56ssh_gssapi_krb5_init(void) |
57{ 58 krb5_error_code problem; 59 60 if (krb_context != NULL) 61 return 1; 62 63 problem = krb5_init_context(&krb_context); 64 if (problem) { --- 64 unchanged lines hidden (view full) --- 129 logit("krb5_cc_gen_new(): %.100s", 130 krb5_get_err_text(krb_context, problem)); 131 return; 132 } 133#else 134 { 135 int tmpfd; 136 char ccname[40]; | 57{ 58 krb5_error_code problem; 59 60 if (krb_context != NULL) 61 return 1; 62 63 problem = krb5_init_context(&krb_context); 64 if (problem) { --- 64 unchanged lines hidden (view full) --- 129 logit("krb5_cc_gen_new(): %.100s", 130 krb5_get_err_text(krb_context, problem)); 131 return; 132 } 133#else 134 { 135 int tmpfd; 136 char ccname[40]; |
137 mode_t old_umask; |
|
137 138 snprintf(ccname, sizeof(ccname), 139 "FILE:/tmp/krb5cc_%d_XXXXXX", geteuid()); 140 | 138 139 snprintf(ccname, sizeof(ccname), 140 "FILE:/tmp/krb5cc_%d_XXXXXX", geteuid()); 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)); 143 problem = errno; 144 return; 145 } 146 if (fchmod(tmpfd, S_IRUSR | S_IWUSR) == -1) { 147 logit("fchmod(): %.100s", strerror(errno)); 148 close(tmpfd); 149 problem = errno; --- 65 unchanged lines hidden --- | 146 logit("mkstemp(): %.100s", strerror(errno)); 147 problem = errno; 148 return; 149 } 150 if (fchmod(tmpfd, S_IRUSR | S_IWUSR) == -1) { 151 logit("fchmod(): %.100s", strerror(errno)); 152 close(tmpfd); 153 problem = errno; --- 65 unchanged lines hidden --- |