Parcourir la source

Access wildcard

Serj Kalichev il y a 11 ans
Parent
commit
2941f06afa
1 fichiers modifiés avec 7 ajouts et 0 suppressions
  1. 7 0
      clish/builtin/hook_access.c

+ 7 - 0
clish/builtin/hook_access.c

@@ -50,6 +50,11 @@ CLISH_HOOK_ACCESS(clish_hook_access)
 	/* The allowed groups are indicated by a colon-separated (:) list. */
 	for (tmp_access = strtok_r(full_access, ":", &saveptr);
 		tmp_access; tmp_access = strtok_r(NULL, ":", &saveptr)) {
+		/* Check for the "*" wildcard */
+		if (0 == strcmp("*", tmp_access)) {
+			allowed = BOOL_TRUE;
+			break;
+		}
 		/* The internal loop goes trough the system group list */
 		for (i = 0; i < num_groups; i++) {
 			struct group *ptr = lub_db_getgrgid(group_list[i]);
@@ -63,6 +68,8 @@ CLISH_HOOK_ACCESS(clish_hook_access)
 			}
 			free(ptr);
 		}
+		if (BOOL_TRUE == allowed)
+			break;
 	}
 
 	lub_string_free(full_access);