]> mj.ucw.cz Git - subauth.git/blobdiff - server/auth.c
Account management using password authentication
[subauth.git] / server / auth.c
index 2205c2e9e52a0ca5e5ce7d368b7b03683debb7fc..257b560ce2c39726a95743a98f33a8afad48fa16 100644 (file)
@@ -264,6 +264,11 @@ static void db_parse_user(struct json_node *ju)
        die("Database defines accounts in zone %s, which is not configured", zone_name);
       clist_init(&aa->tokens);
 
+      uint allow_passwd_auth;
+      if (!get_uint(ja, "p", &allow_passwd_auth))
+       allow_passwd_auth = 0;
+      aa->allow_passwd_auth = allow_passwd_auth;
+
       struct json_node **jts = get_array(ja, "t");
       if (jts)
        {
@@ -375,6 +380,7 @@ void db_write(void)
          struct json_node *ja = json_new_object(js);
          json_array_append(jas, ja);
          json_object_set(ja, "z", json_new_string_ref(js, aa->zone->name));
+         json_object_set(ja, "p", json_new_number(js, aa->allow_passwd_auth));
          struct json_node *jts = json_new_array(js);
          CLIST_FOR_EACH(struct auth_token *, at, aa->tokens)
            {