+static void uh_config_parse(const char *path)
+{
+ FILE *c;
+ char line[512];
+ char *user = NULL;
+ char *pass = NULL;
+ char *eol = NULL;
+
+ if( (c = fopen(path ? path : "/etc/httpd.conf", "r")) != NULL )
+ {
+ memset(line, 0, sizeof(line));
+
+ while( fgets(line, sizeof(line) - 1, c) )
+ {
+ if( (line[0] == '/') && (strchr(line, ':') != NULL) )
+ {
+ if( !(user = strchr(line, ':')) || (*user++ = 0) ||
+ !(pass = strchr(user, ':')) || (*pass++ = 0) ||
+ !(eol = strchr(pass, '\n')) || (*eol++ = 0) )
+ continue;
+
+ if( !uh_auth_add(line, user, pass) )
+ {
+ fprintf(stderr,
+ "Can not manage more than %i basic auth realms, "
+ "will skip the rest\n", UH_LIMIT_AUTHREALMS
+ );
+
+ break;
+ }
+ }
+ }
+
+ fclose(c);
+ }
+}
+