fwrite(ybuf, len, 1, stdout);
yajl_gen_free(g);
+ } else if (strncmp(path, "/passwd", 7) == 0) {
+ const char *username = cgi_getentrystr("username");
+ if (!check_auth(username))
+ exit(0);
+
+ const char *password = cgi_getentrystr("password");
+ const char *new_password = cgi_getentrystr("new_password");
+ if (password == NULL || new_password == NULL) {
+ respond_JSON_Failure();
+ } else {
+ if (auth_check_password(username, password)) {
+ auth_set_password(username, new_password);
+ respond_JSON_Success();
+ } else {
+ respond_JSON_Failure();
+ }
+ }
} else {
respond_404();
exit(0);