]> git.sur5r.net Git - ngadmin/blobdiff - lib/src/network.c
Add invalid operation error code
[ngadmin] / lib / src / network.c
index 8f26fc921a010e71dbeddce811b00d2c52fcfd44..e62b5b89c23fe085433c409cb99351f813f74311 100644 (file)
@@ -149,6 +149,10 @@ static int checkErrorCode (const struct nsdp_cmd *nc)
        case 0:
                return ERR_OK;
        
+       case ERROR_READONLY:
+       case ERROR_WRITEONLY:
+               return ERR_INVOP;
+
        case ERROR_DENIED:
                return (nc->attr_error == ATTR_PASSWORD) ? ERR_BADPASS : ERR_DENIED;
        
@@ -314,7 +318,7 @@ end:
 }
 
 
-void extractSwitchAttributes (struct swi_attr *sa, const List *l)
+int extractSwitchAttributes (struct swi_attr *sa, const List *l)
 {
        const ListNode *ln;
        const struct attr *at;
@@ -325,6 +329,12 @@ void extractSwitchAttributes (struct swi_attr *sa, const List *l)
        
        for (ln = l->first; ln != NULL; ln = ln->next) {
                at = ln->data;
+               if (at->size == 0) {
+                       if (at->attr == ATTR_NAME)
+                               continue;
+                       else
+                               return -EMSGSIZE;
+               }
                
                switch (at->attr) {
                
@@ -374,9 +384,12 @@ void extractSwitchAttributes (struct swi_attr *sa, const List *l)
                        break;
                
                case ATTR_END:
-                       return;
+                       return 0;
                }
        }
+       
+       
+       return 0;
 }