Index: cmd.c
===================================================================
--- cmd.c	(revision 5dfeb4cfe6e0f1c57723a92e38b3d97a5501d0b9)
+++ cmd.c	(revision 677a45b0962b882f3296ae4a62c2df400a73c894)
@@ -177,5 +177,5 @@
 			return;
 		} else {
-			if ((ig = icb_addgroup(is, group, NULL)) == NULL) {
+			if ((ig = icb_addgroup(is, group)) == NULL) {
 				icb_error(is, "Can't create group");
 				return;
Index: icb.c
===================================================================
--- icb.c	(revision 5dfeb4cfe6e0f1c57723a92e38b3d97a5501d0b9)
+++ icb.c	(revision 677a45b0962b882f3296ae4a62c2df400a73c894)
@@ -168,5 +168,5 @@
 			return (1);
 		} else {
-			if ((ig = icb_addgroup(is, group, NULL)) == NULL) {
+			if ((ig = icb_addgroup(is, group)) == NULL) {
 				icb_error(is, "Can't create group %s", group);
 				return (0);
@@ -441,5 +441,5 @@
  */
 struct icb_group *
-icb_addgroup(struct icb_session *is, char *name, char *mpass)
+icb_addgroup(struct icb_session *is, char *name)
 {
 	struct icb_group *ig;
@@ -448,6 +448,4 @@
 		return (NULL);
 	strlcpy(ig->name, name, sizeof ig->name);
-	if (mpass)
-		strlcpy(ig->mpass, mpass, sizeof ig->mpass);
 	if (is)
 		ig->mod = is;
@@ -628,4 +626,43 @@
 
 /*
+ *  icb_token: copies a sequence of characters delimited by the 'sep' character
+ *             from the source buffer 'buf' at offset indicated by 'bufptr' to
+ *             the destination buffer 'dst' and sets 'bufptr' to the next byte
+ *             after 'sep'.
+ */
+int
+icb_token(char *buf, int len, char **bufptr, char *dst, int dlen, int sep)
+{
+	char *start;
+	int i, ret;
+
+	if (buf == NULL || len <= 0 || dlen <= 0)
+		return (0);
+	if (*bufptr == NULL)
+		*bufptr = buf;
+	start = *bufptr;
+	for (i = *bufptr - buf; i < len; i++, (*bufptr)++) {
+		if (**bufptr == sep || **bufptr == '\0') {
+			/* copy and null terminate the token */
+			ret = strlcpy(dst, start,
+			    MIN(*bufptr - start + 1, dlen));
+			if (**bufptr != '\0')
+				(*bufptr)++;
+			return (ret);
+		}
+	}
+	/*
+	 * Reached the end of the buffer without finding a field separator
+	 * nor the end of line character.  If we have advanced our pointer
+	 * we should copy the resulting single field out.
+	 */
+	if (*bufptr - start > 0) {
+		ret = strlcpy(dst, start, MIN(*bufptr - start + 1, dlen));
+		return (ret);
+	}
+	return (0);
+}
+
+/*
  *  icb_vis: strnvis-like function that escapes percentages as well
  */
Index: icb.h
===================================================================
--- icb.h	(revision 5dfeb4cfe6e0f1c57723a92e38b3d97a5501d0b9)
+++ icb.h	(revision 677a45b0962b882f3296ae4a62c2df400a73c894)
@@ -28,5 +28,4 @@
 #define ICB_MAXGRPLEN		 32
 #define ICB_MAXNICKLEN		 32
-#define ICB_MAXPASSLEN		 32
 #define ICB_MAXTOPICLEN		 160
 #define ICB_MAXHOSTLEN		 40
@@ -107,5 +106,4 @@
 struct icb_group {
 	char			 name[ICB_MAXGRPLEN];
-	char			 mpass[ICB_MAXPASSLEN];
 	char			 topic[ICB_MAXTOPICLEN];
 	LIST_ENTRY(icb_group)	 entry;
@@ -125,5 +123,5 @@
 /* icb.c */
 struct icb_group *
-		icb_addgroup(struct icb_session *, char *, char *);
+		icb_addgroup(struct icb_session *, char *);
 void		icb_cmdout(struct icb_session *, int, char *);
 void		icb_delgroup(struct icb_group *);
@@ -143,3 +141,4 @@
 		    int, const char *, ...);
 void		icb_who(struct icb_session *, struct icb_group *);
+int		icb_token(char *, int, char **, char *, int, int);
 int		icb_vis(char *, const char *, size_t, int);
Index: icbd.c
===================================================================
--- icbd.c	(revision 5dfeb4cfe6e0f1c57723a92e38b3d97a5501d0b9)
+++ icbd.c	(revision 677a45b0962b882f3296ae4a62c2df400a73c894)
@@ -65,5 +65,4 @@
 void icbd_dispatch(struct bufferevent *, void *);
 void icbd_log(struct icb_session *, int, const char *, ...);
-void icbd_grplist(char *);
 void icbd_restrict(void);
 void icbd_send(struct icb_session *, char *, ssize_t);
@@ -79,4 +78,6 @@
 	int ch, nsocks = 0, save_errno = 0;
 	int inet4 = 0, inet6 = 0;
+	char group[ICB_MAXGRPLEN], *grplist = NULL;
+	char *ptr = NULL;
 
 	/* init group lists before calling icb_addgroup */
@@ -98,5 +99,5 @@
 			break;
 		case 'G':
-			icbd_grplist(optarg);
+			grplist = optarg;
 			break;
 		case 'L':
@@ -124,6 +125,13 @@
 
 	/* add group "1" as it's a login group for most of the clients */
-	if (icb_addgroup(NULL, "1", NULL) == NULL)
+	if (icb_addgroup(NULL, "1") == NULL)
 		err(EX_UNAVAILABLE, NULL);
+
+	if (grplist) {
+		while (icb_token(grplist, strlen(grplist), &ptr, group,
+		    ICB_MAXGRPLEN, ',') > 0)
+			if (icb_addgroup(NULL, group) == NULL)
+				err(EX_UNAVAILABLE, NULL);
+	}
 
 	if (argc == 0)
@@ -492,32 +500,4 @@
 
 void
-icbd_grplist(char *list)
-{
-	char *s, *s1, *s2;
-	int last = 0;
-
-	if (!list || strlen(list) == 0)
-		return;
-
-	/* "group1[:pass1][,group2[:pass2],...]" */
-	s = list;
-	s1 = s2 = NULL;
-	while (!last && s) {
-		if ((s1 = strchr(s, ',')) != NULL)
-			*s1 = '\0';
-		else {
-			last = 1;
-			s1 = s;
-		}
-		if ((s2 = strchr(s, ':')) != NULL)
-			*s2 = '\0';
-		if (icb_addgroup(NULL, s, s2 ? ++s2 : NULL) == NULL)
-			err(EX_UNAVAILABLE, NULL);
-		s = ++s1;
-		s1 = s2 = NULL;
-	}
-}
-
-void
 icbd_modupdate(void)
 {
