Changeset a785c27 in code
- Timestamp:
- Jan 8, 2010, 1:16:34 PM (15 years ago)
- Branches:
- master
- Children:
- c45628b
- Parents:
- 8bf5a0a
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
icb.c
r8bf5a0a ra785c27 29 29 30 30 extern int creategroups; 31 extern char srvname[MAXHOSTNAMELEN]; 31 32 32 33 void icb_command(struct icb_session *, char *, char *); … … 46 47 47 48 LIST_INIT(&groups); 49 50 if (strlen(srvname) == 0) 51 (void)gethostname(srvname, sizeof srvname); 52 /* 53 * MAXHOSTNAMELEN is usually greater than what we 54 * can actually send, hence truncation: 55 */ 56 if (strlen(srvname) > 200) 57 srvname[200] = '\0'; 48 58 } 49 59 … … 54 64 icb_start(struct icb_session *is) 55 65 { 56 char hname[MAXHOSTNAMELEN]; 57 58 bzero(hname, sizeof hname); 59 (void)gethostname(hname, sizeof hname); 60 icb_sendfmt(is, "%c%c%c%s%c%s", ICB_M_PROTO, '1', ICB_M_SEP, hname, 66 icb_sendfmt(is, "%c%c%c%s%c%s", ICB_M_PROTO, '1', ICB_M_SEP, srvname, 61 67 ICB_M_SEP, "icbd"); 62 68 SETF(is->flags, ICB_SF_PROTOSENT); -
icbd.c
r8bf5a0a ra785c27 42 42 extern char *__progname; 43 43 44 int creategroups; 45 int foreground; 46 int verbose; 44 char srvname[MAXHOSTNAMELEN]; 45 int creategroups; 46 int foreground; 47 int verbose; 47 48 48 49 void usage(void); … … 72 73 icb_init(&ic); 73 74 74 while ((ch = getopt(argc, argv, "46CdG: v")) != -1)75 while ((ch = getopt(argc, argv, "46CdG:S:v")) != -1) 75 76 switch (ch) { 76 77 case '4': … … 88 89 case 'G': 89 90 icbd_grplist(optarg); 91 break; 92 case 'S': 93 strlcpy(srvname, optarg, sizeof srvname); 90 94 break; 91 95 case 'v':
Note:
See TracChangeset
for help on using the changeset viewer.