give the possibility to pass an error message to the user
authorpk910 <philipp@zoelle1.de>
Wed, 3 Aug 2011 12:46:00 +0000 (14:46 +0200)
committerpk910 <philipp@zoelle1.de>
Wed, 3 Aug 2011 12:46:00 +0000 (14:46 +0200)
iauth.h
iauth_query.c

diff --git a/iauth.h b/iauth.h
index 2e0abf65a138eeb8a218a3a9730d0b70cb944bef..05d43edbd47a84b6721e1578f093ee7b140059ea 100644 (file)
--- a/iauth.h
+++ b/iauth.h
@@ -108,6 +108,7 @@ struct iauth_result {
     char host[IAUTH_DATALEN + 1];
     char ip[IAUTH_DATALEN + 1];
     char modes[IAUTH_DATALEN + 1];
+    char str[600];
 };
 extern const struct iauth_result *iauth_query(struct iauth_client *cli);
 extern char iauth_servname[IAUTH_DATALEN + 1];
index 7c7c7145bc0e54c131e283dc16c77cf81b0b23a3..d0026ff44be38efd9d85b958040d171f6a23fff4 100644 (file)
@@ -113,6 +113,18 @@ const struct iauth_result *iauth_query(struct iauth_client *cli) {
         return NULL;
     }
     *arg++ = 0;
+    if(strcmp(tread, "error") == 0) {
+        strcpy(res.cclass, "error");
+       tread = arg;
+    if(!(arg = strchr(tread, '%'))) {
+        close(fds[0]);
+        return NULL;
+    }
+    *arg++ = 0;
+       
+        strcpy(res.str, tread);
+        return &res;
+       }
     if(strcmp(tread, "$") == 0 || strlen(tread) > IAUTH_DATALEN) res.cclass[0] = 0;
     else strcpy(res.cclass, tread);
 
@@ -148,10 +160,11 @@ const struct iauth_result *iauth_query(struct iauth_client *cli) {
 
     /* Read modes string. */
     tread = arg;
-    if(!*tread) {
+    if(!(arg = strchr(tread, '%'))) {
         close(fds[0]);
         return NULL;
     }
+    *arg++ = 0;
     if(strcmp(tread, "$") == 0 || strlen(tread) > IAUTH_DATALEN) res.modes[0] = 0;
     else strcpy(res.modes, tread);