Changeset 452 for trunk/src/sh_suidchk.c
- Timestamp:
- Jun 26, 2014, 8:01:54 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_suidchk.c
r440 r452 82 82 #include "sh_schedule.h" 83 83 #include "sh_calls.h" 84 #include "zAVLTree.h" 84 85 85 86 … … 146 147 static int ShSuidchkQDelete = S_FALSE; 147 148 static int ShSuidchkSeverity = SH_ERR_SEVERE; 148 static char * ShSuidchkExclude = NULL;149 static size_t ExcludeLen = 0;150 149 151 150 static time_t FileLimNow = 0; … … 155 154 156 155 static sh_schedule_t * ShSuidchkSched = NULL; 156 157 158 static zAVLTree * ShSuidchkExclude = NULL; 159 static void sh_suid_exclude_free() 160 { 161 zAVL_string_reset(ShSuidchkExclude); 162 ShSuidchkExclude = NULL; 163 return; 164 } 165 static int sh_suid_exclude_add(const char * str) 166 { 167 size_t len; 168 int ret; 169 char * key = sh_util_strdup(str); 170 171 len = sl_strlen (key); 172 if (len && key[len-1] == '/') 173 { 174 key[len-1] = '\0'; 175 } 176 ret = zAVL_string_set(&ShSuidchkExclude, key); 177 SH_FREE(key); 178 return ret; 179 } 180 157 181 158 182 static char * … … 179 203 ShSuidchkSeverity = SH_ERR_SEVERE; 180 204 if (ShSuidchkExclude != NULL) 181 SH_FREE(ShSuidchkExclude); 182 ShSuidchkExclude = NULL; 183 ExcludeLen = 0; 205 sh_suid_exclude_free(ShSuidchkExclude); 184 206 185 207 FileLimNow = 0; … … 1136 1158 if (tlen >= 6 && 0 == strcmp(&tmp[tlen-6], _("/.gvfs"))) 1137 1159 elevel = SH_ERR_NOTICE; 1160 else if (tlen >= 5 && 0 == strcmp(&((mnt->mnt_dir)[tlen-5]), _("/gvfs"))) 1161 elevel = SH_ERR_NOTICE; 1138 1162 1139 1163 /* If we are scanning a temporary directory where dirs and files … … 1156 1180 if (/*@-usedef@*/S_ISDIR(buf.st_mode)/*@+usedef@*/ && 1157 1181 (ShSuidchkExclude == NULL || 1158 0 != strcmp(tmpcat, ShSuidchkExclude)))1182 NULL == zAVL_string_get(ShSuidchkExclude, tmpcat))) 1159 1183 { 1160 1184 /* fs is a STATIC string or NULL … … 1529 1553 int sh_suidchk_set_exclude (const char * c) 1530 1554 { 1555 int ret = 0; 1531 1556 SL_ENTER(_("sh_suidchk_set_exclude")); 1532 1557 … … 1539 1564 { 1540 1565 if (ShSuidchkExclude != NULL) 1541 SH_FREE(ShSuidchkExclude); 1542 ShSuidchkExclude = NULL; 1566 sh_suid_exclude_free(); 1543 1567 SL_RETURN(0, _("sh_suidchk_set_exclude")); 1544 1568 } 1545 1569 1546 if (ShSuidchkExclude != NULL) 1547 SH_FREE(ShSuidchkExclude); 1548 1549 ShSuidchkExclude = sh_util_strdup (c); 1550 ExcludeLen = sl_strlen (ShSuidchkExclude); 1551 if (ShSuidchkExclude && ShSuidchkExclude[ExcludeLen-1] == '/') 1552 { 1553 ShSuidchkExclude[ExcludeLen-1] = '\0'; 1554 ExcludeLen--; 1555 } 1556 SL_RETURN(0, _("sh_suidchk_set_exclude")); 1570 ret = sh_suid_exclude_add(c); 1571 1572 SL_RETURN(ret, _("sh_suidchk_set_exclude")); 1557 1573 } 1558 1574
Note:
See TracChangeset
for help on using the changeset viewer.