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/blacklist.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/blacklist.c')
-rw-r--r-- | database/sqlite/administration/blacklist.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/database/sqlite/administration/blacklist.c b/database/sqlite/administration/blacklist.c index d8824ea..80c4506 100644 --- a/database/sqlite/administration/blacklist.c +++ b/database/sqlite/administration/blacklist.c @@ -139,7 +139,7 @@ xmlDoc *blacklist_add(eurephiaCTX *ctx, eDBfieldMap *fmap) { fields = eDBmappingFieldsPresent(fmap); if( (fields != FIELD_UNAME) && (fields != FIELD_CERTDIGEST) && (fields != FIELD_REMOTEIP) ) { - return eurephiaXML_ResultMsg(ctx, exmlERROR, + return eurephiaXML_ResultMsg(ctx, exmlERROR, NULL, "Missing username, IP address or certificate digest, " "or multiple of these fields were given."); } @@ -147,9 +147,9 @@ xmlDoc *blacklist_add(eurephiaCTX *ctx, eDBfieldMap *fmap) { res = sqlite_query_mapped(ctx, SQL_INSERT, "INSERT INTO openvpn_blacklist", fmap, NULL, NULL); if( res == NULL ) { eurephia_log(ctx, LOG_FATAL, 0, "Could not blacklist the requested data"); - ret = eurephiaXML_ResultMsg(ctx, exmlERROR, "Blacklisting failed"); + ret = eurephiaXML_ResultMsg(ctx, exmlERROR, NULL, "Blacklisting failed"); } else { - ret = eurephiaXML_ResultMsg(ctx, exmlRESULT, "Record registered in the blacklist"); + ret = eurephiaXML_ResultMsg(ctx, exmlRESULT, NULL, "Record registered in the blacklist"); sqlite_free_results(res); } return ret; @@ -171,16 +171,16 @@ xmlDoc *blacklist_delete(eurephiaCTX *ctx, eDBfieldMap *fmap) { fields = eDBmappingFieldsPresent(fmap); if( (fields & (FIELD_UNAME | FIELD_CERTDIGEST | FIELD_REMOTEIP | FIELD_RECID)) == 0 ) { - return eurephiaXML_ResultMsg(ctx, exmlERROR, + return eurephiaXML_ResultMsg(ctx, exmlERROR, NULL, "Missing username, IP address, certificate digest or blacklist ID"); } res = sqlite_query_mapped(ctx, SQL_DELETE, "DELETE FROM openvpn_blacklist", NULL, fmap, NULL); if( res == NULL ) { eurephia_log(ctx, LOG_FATAL, 0, "Could not remove blacklisting"); - ret = eurephiaXML_ResultMsg(ctx, exmlERROR, "Failed to remove the blacklisting"); + ret = eurephiaXML_ResultMsg(ctx, exmlERROR, NULL, "Failed to remove the blacklisting"); } else { - ret = eurephiaXML_ResultMsg(ctx, exmlRESULT, "Blacklisting removed"); + ret = eurephiaXML_ResultMsg(ctx, exmlRESULT, NULL, "Blacklisting removed"); sqlite_free_results(res); } return ret; @@ -230,7 +230,7 @@ xmlDoc *eDBadminBlacklist(eurephiaCTX *ctx, xmlDoc *qryxml) { resxml = blacklist_delete(ctx, fmap); } else { eurephia_log(ctx, LOG_ERROR, 0, "Blacklist - Unknown mode: '%s'", mode); - resxml = eurephiaXML_ResultMsg(ctx, exmlERROR, "Unknown mode '%s'", mode); + resxml = eurephiaXML_ResultMsg(ctx, exmlERROR, NULL, "Unknown mode '%s'", mode); } eDBfreeMapping(fmap); return resxml; |