]> jfr.im git - irc/quakenet/newserv.git/blobdiff - newsearch/ns-hostmask.c
LUA: port luadb to dbapi2 to drop postgres dependency
[irc/quakenet/newserv.git] / newsearch / ns-hostmask.c
index 421e3cef124e1ef1438d50c31fffb3aa8599e93f..caa66e081c314d0d6b37c649945006ff99e34a31 100644 (file)
@@ -18,14 +18,25 @@ void hostmask_free(searchCtx *ctx, struct searchNode *thenode);
 
 struct searchNode *hostmask_parse(searchCtx *ctx, int argc, char **argv) {
   struct searchNode *thenode;
-  int realhost = 0, realname = 0, i;
+  int realhost = 0, realname = 0, i, error = 0;
   
   for(i=0;i<argc;i++) {
-    if(!ircd_strcmp(argv[i], "realhost")) {
+    struct searchNode *convsn;
+    char *p;
+    
+    if (!(convsn=argtoconststr("hostmask", ctx, argv[i], &p)))
+      return NULL;
+    
+    if(!ircd_strcmp(p, "realhost")) {
       realhost = 1;
-    } else if(!ircd_strcmp(argv[i], "realname")) {
+    } else if(!ircd_strcmp(p, "realname")) {
       realname = 1;
     } else {
+      error = 1;
+    }
+    convsn->free(ctx, convsn);
+    
+    if(error) {
       parseError = "bad argument: use realhost and/or realname";
       return NULL;
     }