1
0
mirror of https://github.com/lammertb/libhttp.git synced 2026-01-03 16:02:30 +03:00

Changed API: function mg_modify_passwords_file(). Instead of passing context, a domain name is passed, thus making this function completely mongoose-agnostic.

This commit is contained in:
valenok
2011-02-18 16:40:58 +00:00
parent 27ccf416c1
commit 29716fa22e
3 changed files with 7 additions and 25 deletions

19
main.c
View File

@@ -85,23 +85,6 @@ static void die(const char *fmt, ...) {
exit(EXIT_FAILURE);
}
/*
* Edit the passwords file.
*/
static int mg_edit_passwords(const char *fname, const char *domain,
const char *user, const char *pass) {
struct mg_context *ctx;
const char *options[] = {"authentication_domain", NULL, NULL};
int success;
options[1] = domain;
ctx = mg_start(NULL, NULL, options);
success = mg_modify_passwords_file(ctx, fname, user, pass);
mg_stop(ctx);
return success;
}
static void show_usage_and_exit(void) {
const char **names;
int i;
@@ -240,7 +223,7 @@ static void start_mongoose(int argc, char *argv[]) {
if (argc != 6) {
show_usage_and_exit();
}
exit(mg_edit_passwords(argv[2], argv[3], argv[4], argv[5]) ?
exit(mg_modify_passwords_file(argv[2], argv[3], argv[4], argv[5]) ?
EXIT_SUCCESS : EXIT_FAILURE);
}