diff options
| author | David Sommerseth <dazo@users.sourceforge.net> | 2009-09-21 19:04:36 +0200 |
|---|---|---|
| committer | David Sommerseth <dazo@users.sourceforge.net> | 2009-09-21 19:04:36 +0200 |
| commit | 8fc41296cd27af9757f571627f7fd16befc9b8aa (patch) | |
| tree | 9a2d242654c938ae0b0a327d649f7d7e7f875586 /database/sqlite/administration/usercerts.c | |
| parent | 854f3bb476a3cb7cf370c0f7690d9a376d219609 (diff) | |
| download | eurephia-8fc41296cd27af9757f571627f7fd16befc9b8aa.tar.gz eurephia-8fc41296cd27af9757f571627f7fd16befc9b8aa.tar.xz eurephia-8fc41296cd27af9757f571627f7fd16befc9b8aa.zip | |
Rewrote eurephiaXML_ResultMsg() to also support adding an xmlNode* with more info
The eurephia result XML document is also changed, and all parsing of the result must
be rewritten. To simplify this parsing, a new function is introduced,
eurephiaXML_ParseResultMsg().
Diffstat (limited to 'database/sqlite/administration/usercerts.c')
| -rw-r--r-- | database/sqlite/administration/usercerts.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/database/sqlite/administration/usercerts.c b/database/sqlite/administration/usercerts.c index 408891f..4387dcf 100644 --- a/database/sqlite/administration/usercerts.c +++ b/database/sqlite/administration/usercerts.c @@ -165,7 +165,7 @@ xmlDoc *usercerts_add_del(eurephiaCTX *ctx, const char *mode, eDBfieldMap *usrcr dbres = sqlite_query_mapped(ctx, SQL_INSERT, "INSERT INTO openvpn_usercerts", usrcrt_m, NULL, NULL); if( dbres ) { - res = eurephiaXML_ResultMsg(ctx, exmlRESULT, + res = eurephiaXML_ResultMsg(ctx, exmlRESULT, NULL, "Registered new user-cert link with id %i", dbres->last_insert_id); } @@ -173,21 +173,21 @@ xmlDoc *usercerts_add_del(eurephiaCTX *ctx, const char *mode, eDBfieldMap *usrcr dbres = sqlite_query_mapped(ctx, SQL_DELETE, "DELETE FROM openvpn_usercerts", NULL, usrcrt_m, NULL); if( dbres ) { - int num_rows = sqlite_get_affected_rows(dbres); - if( num_rows > 0 ) { - res = eurephiaXML_ResultMsg(ctx, exmlRESULT, - "Removed %i user-cert %s successfully", - num_rows, (num_rows == 1 ? "link" : "links")); - } else { - res = eurephiaXML_ResultMsg(ctx, exmlERROR, - "No user-cert links where removed"); - } + int num_rows = sqlite_get_affected_rows(dbres); + if( num_rows > 0 ) { + res = eurephiaXML_ResultMsg(ctx, exmlRESULT, NULL, + "Removed %i user-cert %s successfully", + num_rows, (num_rows == 1 ? "link" : "links")); + } else { + res = eurephiaXML_ResultMsg(ctx, exmlERROR, NULL, + "No user-cert links where removed"); + } } } if( dbres == NULL ) { eurephia_log(ctx, LOG_ERROR, 0, "Failed to %s user-cert link.", mode); - res = eurephiaXML_ResultMsg(ctx, exmlERROR, "Failed to %s user-cert link", mode); + res = eurephiaXML_ResultMsg(ctx, exmlERROR, NULL, "Failed to %s user-cert link", mode); } else { sqlite_free_results(dbres); } @@ -233,17 +233,17 @@ xmlDoc *usercerts_update(eurephiaCTX *ctx, const char *uicid, eDBfieldMap *usrcr if( dbres ) { int num_rows = sqlite_get_affected_rows(dbres); if( num_rows > 0 ) { - res = eurephiaXML_ResultMsg(ctx, exmlRESULT, + res = eurephiaXML_ResultMsg(ctx, exmlRESULT, NULL, "Updated firewall access profile on %i user-cert %s.", num_rows, (num_rows == 1 ? "link" : "links")); } else { - res = eurephiaXML_ResultMsg(ctx, exmlERROR, + res = eurephiaXML_ResultMsg(ctx, exmlERROR, NULL, "No user-cert links where updated"); } sqlite_free_results(dbres); } else { eurephia_log(ctx, LOG_ERROR, 0, "Failed to update user-cert link.(uicid: %s)", uicid); - res = eurephiaXML_ResultMsg(ctx, exmlERROR, + res = eurephiaXML_ResultMsg(ctx, exmlERROR, NULL, "Failed to update user-cert link for uicid %s", uicid); } eDBfreeMapping(where_m); @@ -306,7 +306,7 @@ xmlDoc *eDBadminUserCertsLink(eurephiaCTX *ctx, xmlDoc *usrcrt_xml) { uicid = xmlGetAttrValue(usrcrt_n->properties, "uicid"); if( uicid == NULL ) { eurephia_log(ctx, LOG_ERROR, 0, "Missing required attribute, uicid, for updates"); - resxml = eurephiaXML_ResultMsg(ctx, exmlERROR, + resxml = eurephiaXML_ResultMsg(ctx, exmlERROR, NULL, "Can not set firewall access profile without uicid"); goto exit; } |
