Lines 244-251
ssh_gssapi_k5login_exists()
Link Here
|
244 |
{ |
244 |
{ |
245 |
char file[MAXPATHLEN]; |
245 |
char file[MAXPATHLEN]; |
246 |
struct passwd *pw = the_authctxt->pw; |
246 |
struct passwd *pw = the_authctxt->pw; |
|
|
247 |
char *k5login_directory = NULL; |
248 |
int ret = 0; |
249 |
|
250 |
ret = ssh_krb5_get_k5login_directory(krb_context, &k5login_directory); |
251 |
debug3("%s: k5login_directory = %s (rv=%d)", __func__, k5login_directory, ret); |
252 |
if (k5login_directory == NULL || ret != 0) { |
253 |
/* If not set, the library will look for k5login |
254 |
* files in the user's home directory, with the filename .k5login. |
255 |
*/ |
256 |
snprintf(file, sizeof(file), "%s/.k5login", pw->pw_dir); |
257 |
} else { |
258 |
/* If set, the library will look for a local user's k5login file |
259 |
* within the named directory, with a filename corresponding to the |
260 |
* local username. |
261 |
*/ |
262 |
snprintf(file, sizeof(file), "%s%s%s", k5login_directory, |
263 |
k5login_directory[strlen(k5login_directory)-1] != '/' ? "/" : "", |
264 |
pw->pw_name); |
265 |
} |
266 |
debug("%s: Checking existence of file %s", __func__, file); |
247 |
|
267 |
|
248 |
snprintf(file, sizeof(file), "%s/.k5login", pw->pw_dir); |
|
|
249 |
return access(file, F_OK) == 0; |
268 |
return access(file, F_OK) == 0; |
250 |
} |
269 |
} |
251 |
|
270 |
|