Changeset 519 in openpam
- Timestamp:
- Jan 10, 2012, 11:50:03 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/openpam_check_owner_perms.c
r509 r519 68 68 return (-1); 69 69 } 70 if (!S_ISREG(sb.st_mode)) { 71 openpam_log(PAM_LOG_ERROR, 72 "%s: not a regular file", name); 73 errno = EINVAL; 74 return (-1); 75 } 70 76 if ((sb.st_uid != root && sb.st_uid != arbitrator) || 71 77 (sb.st_mode & (S_IWGRP|S_IWOTH)) != 0) { … … 85 91 * not writable by group or other. 86 92 * 87 * Note that openpam_check_ file_owner_perms() should be used instead if93 * Note that openpam_check_desc_owner_perms() should be used instead if 88 94 * possible to avoid a race between the ownership / permission check and 89 95 * the actual open(). … … 96 102 char pathbuf[PATH_MAX]; 97 103 struct stat sb; 98 int len, serrno ;104 int len, serrno, tip; 99 105 106 tip = 1; 100 107 root = 0; 101 108 arbitrator = geteuid(); … … 112 119 return (-1); 113 120 } 121 if (tip && !S_ISREG(sb.st_mode)) { 122 openpam_log(PAM_LOG_ERROR, 123 "%s: not a regular file", pathbuf); 124 errno = EINVAL; 125 return (-1); 126 } 114 127 if ((sb.st_uid != root && sb.st_uid != arbitrator) || 115 128 (sb.st_mode & (S_IWGRP|S_IWOTH)) != 0) { … … 121 134 while (--len > 0 && pathbuf[len] != '/') 122 135 pathbuf[len] = '\0'; 136 tip = 0; 123 137 } 124 138 return (0);
Note: See TracChangeset
for help on using the changeset viewer.