Changeset 43 for trunk/wifidog/src/conf.c
- Timestamp:
- 04/10/04 22:39:57 (9 years ago)
- Files:
-
- 1 modified
-
trunk/wifidog/src/conf.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wifidog/src/conf.c
r39 r43 60 60 oFWScriptsPath, 61 61 oFWType, 62 oUserClass, 62 63 } OpCodes; 63 64 … … 83 84 { "fwscriptspath", oFWScriptsPath }, 84 85 { "fwtype", oFWType }, 86 { "userclass", oUserClass }, 85 87 { NULL, oBadOption }, 86 88 }; … … 108 110 config.fwscripts_path = DEFAULT_FWSCRIPTS_PATH; 109 111 config.fwtype = DEFAULT_FWTYPE; 112 config.userclasses = (char **)malloc(sizeof(char *) * 256); 113 memset(config.userclasses, 0, sizeof(char *) * 256); 110 114 } 111 115 … … 173 177 174 178 switch(opcode) { 179 case oUserClass: 180 add_userclass((int)strtol(p1, NULL, 10), 181 ++p2); 182 break; 175 183 case oDaemon: 176 184 if (((value = parse_value(p1)) != -1)) { … … 243 251 } 244 252 245 char *253 char * 246 254 get_string(char *ptr) 247 255 { 248 256 char *buf; 249 257 250 buf = (char *)malloc(MAX_BUF); 251 252 strncpy(buf, ptr, MAX_BUF); 258 buf = strdup(ptr); 253 259 return buf; 260 } 261 262 char * 263 add_userclass(int profile, char *ptr) 264 { 265 char *tmp_str; 266 267 if (profile > 255 || profile < 0) 268 return NULL; 269 270 if (*(config.userclasses + profile) != NULL) 271 free(*(config.userclasses + profile)); 272 273 tmp_str = strdup(ptr); 274 275 *(config.userclasses + profile) = tmp_str; 276 277 return tmp_str; 254 278 } 255 279
