Allow empty strings to mean NULL
authorAlan T. DeKok <aland@freeradius.org>
Sat, 13 Aug 2011 14:56:28 +0000 (10:56 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sat, 13 Aug 2011 14:56:28 +0000 (10:56 -0400)
this lets us specify the default (i.e. NULL) virtual server

src/main/client.c

index d140d81..b406943 100644 (file)
@@ -1053,7 +1053,11 @@ RADCLIENT *client_create(RADCLIENT_LIST *clients, REQUEST *request)
                case PW_TYPE_STRING_PTR:
                        p = (char **) ((char *) c + dynamic_config[i].offset);
                        if (*p) free(*p);
-                       *p = strdup(vp->vp_strvalue);
+                       if (vp->vp_strvalue[0]) {
+                               *p = strdup(vp->vp_strvalue);
+                       } else {
+                               *p = NULL;
+                       }
                        break;
 
                case PW_TYPE_BOOLEAN: