Bugzilla – Attachment 338 Details for
Bug 606
sshd [-t] should warn when cannot create pid file
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Check directory and file perms for PidFile
openbsd-pidfile_test.patch (text/plain), 1.58 KB, created by
Darren Tucker
on 2003-06-26 21:55:49 AEST
(
hide
)
Description:
Check directory and file perms for PidFile
Filename:
MIME Type:
Creator:
Darren Tucker
Created:
2003-06-26 21:55:49 AEST
Size:
1.58 KB
patch
obsolete
>Index: sshd.c >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/sshd.c,v >retrieving revision 1.269 >diff -u -r1.269 sshd.c >--- sshd.c 2003/06/24 08:23:46 1.269 >+++ sshd.c 2003/06/26 11:43:15 >@@ -801,6 +801,8 @@ > Authctxt *authctxt; > Key *key; > int ret, key_used = 0; >+ char *path = NULL; >+ struct stat st; > > /* Save argv. */ > saved_argv = av; >@@ -1020,6 +1022,28 @@ > "world-writable.", _PATH_PRIVSEP_CHROOT_DIR); > } > >+ /* Determine directory path to PidFile */ >+ if (strrchr(options.pid_file, '/') != NULL) { >+ path = xstrdup(options.pid_file); >+ *(strrchr(path, '/')+1) = '\0'; >+ } else >+ path = xstrdup("."); >+ >+ /* Check if PidFile directory (and file if is exists) is writable */ >+ if (stat(path, &st) == -1) >+ error("Could not check PidFile directory `%.100s' (%s)", path, >+ strerror(errno)); >+ else if (!S_ISDIR(st.st_mode)) >+ error("PidFile directory `%.100s' is not a directory!", path); >+ else if (access(path, W_OK) == -1) >+ error("PidFile directory `%.100s' not writable (%s)", path, >+ strerror(errno)); >+ else if (stat(options.pid_file, &st) == 0 && >+ access(options.pid_file, W_OK) == -1) >+ error("PidFile %.100s exists and is not writable (%s)", >+ options.pid_file, strerror(errno)); >+ xfree(path); >+ > /* Configuration looks good, so exit if in test mode. */ > if (test_flag) > exit(0); >@@ -1164,7 +1188,9 @@ > if (f) { > fprintf(f, "%ld\n", (long) getpid()); > fclose(f); >- } >+ } else >+ error("Failed to write PidFile (%s)", >+ strerror(errno)); > } > > /* setup fd set for listen */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 606
:
338
|
339