- Timestamp:
- Apr 22, 2015, 5:28:48 PM (10 years ago)
- Branches:
- master
- Children:
- 176b6ef
- Parents:
- 5dfeb4c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
icb.c
r5dfeb4c r677a45b 168 168 return (1); 169 169 } else { 170 if ((ig = icb_addgroup(is, group , NULL)) == NULL) {170 if ((ig = icb_addgroup(is, group)) == NULL) { 171 171 icb_error(is, "Can't create group %s", group); 172 172 return (0); … … 441 441 */ 442 442 struct icb_group * 443 icb_addgroup(struct icb_session *is, char *name , char *mpass)443 icb_addgroup(struct icb_session *is, char *name) 444 444 { 445 445 struct icb_group *ig; … … 448 448 return (NULL); 449 449 strlcpy(ig->name, name, sizeof ig->name); 450 if (mpass)451 strlcpy(ig->mpass, mpass, sizeof ig->mpass);452 450 if (is) 453 451 ig->mod = is; … … 628 626 629 627 /* 628 * icb_token: copies a sequence of characters delimited by the 'sep' character 629 * from the source buffer 'buf' at offset indicated by 'bufptr' to 630 * the destination buffer 'dst' and sets 'bufptr' to the next byte 631 * after 'sep'. 632 */ 633 int 634 icb_token(char *buf, int len, char **bufptr, char *dst, int dlen, int sep) 635 { 636 char *start; 637 int i, ret; 638 639 if (buf == NULL || len <= 0 || dlen <= 0) 640 return (0); 641 if (*bufptr == NULL) 642 *bufptr = buf; 643 start = *bufptr; 644 for (i = *bufptr - buf; i < len; i++, (*bufptr)++) { 645 if (**bufptr == sep || **bufptr == '\0') { 646 /* copy and null terminate the token */ 647 ret = strlcpy(dst, start, 648 MIN(*bufptr - start + 1, dlen)); 649 if (**bufptr != '\0') 650 (*bufptr)++; 651 return (ret); 652 } 653 } 654 /* 655 * Reached the end of the buffer without finding a field separator 656 * nor the end of line character. If we have advanced our pointer 657 * we should copy the resulting single field out. 658 */ 659 if (*bufptr - start > 0) { 660 ret = strlcpy(dst, start, MIN(*bufptr - start + 1, dlen)); 661 return (ret); 662 } 663 return (0); 664 } 665 666 /* 630 667 * icb_vis: strnvis-like function that escapes percentages as well 631 668 */
Note:
See TracChangeset
for help on using the changeset viewer.