- Timestamp:
- Apr 22, 2015, 5:28:48 PM (10 years ago)
- Branches:
- master
- Children:
- 176b6ef
- Parents:
- 5dfeb4c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
icbd.c
r5dfeb4c r677a45b 65 65 void icbd_dispatch(struct bufferevent *, void *); 66 66 void icbd_log(struct icb_session *, int, const char *, ...); 67 void icbd_grplist(char *);68 67 void icbd_restrict(void); 69 68 void icbd_send(struct icb_session *, char *, ssize_t); … … 79 78 int ch, nsocks = 0, save_errno = 0; 80 79 int inet4 = 0, inet6 = 0; 80 char group[ICB_MAXGRPLEN], *grplist = NULL; 81 char *ptr = NULL; 81 82 82 83 /* init group lists before calling icb_addgroup */ … … 98 99 break; 99 100 case 'G': 100 icbd_grplist(optarg);101 grplist = optarg; 101 102 break; 102 103 case 'L': … … 124 125 125 126 /* add group "1" as it's a login group for most of the clients */ 126 if (icb_addgroup(NULL, "1" , NULL) == NULL)127 if (icb_addgroup(NULL, "1") == NULL) 127 128 err(EX_UNAVAILABLE, NULL); 129 130 if (grplist) { 131 while (icb_token(grplist, strlen(grplist), &ptr, group, 132 ICB_MAXGRPLEN, ',') > 0) 133 if (icb_addgroup(NULL, group) == NULL) 134 err(EX_UNAVAILABLE, NULL); 135 } 128 136 129 137 if (argc == 0) … … 492 500 493 501 void 494 icbd_grplist(char *list)495 {496 char *s, *s1, *s2;497 int last = 0;498 499 if (!list || strlen(list) == 0)500 return;501 502 /* "group1[:pass1][,group2[:pass2],...]" */503 s = list;504 s1 = s2 = NULL;505 while (!last && s) {506 if ((s1 = strchr(s, ',')) != NULL)507 *s1 = '\0';508 else {509 last = 1;510 s1 = s;511 }512 if ((s2 = strchr(s, ':')) != NULL)513 *s2 = '\0';514 if (icb_addgroup(NULL, s, s2 ? ++s2 : NULL) == NULL)515 err(EX_UNAVAILABLE, NULL);516 s = ++s1;517 s1 = s2 = NULL;518 }519 }520 521 void522 502 icbd_modupdate(void) 523 503 {
Note:
See TracChangeset
for help on using the changeset viewer.