Changeset 3dba97d in code
- Timestamp:
- Mar 5, 2014, 9:41:56 PM (11 years ago)
- Branches:
- master
- Children:
- e54f151
- Parents:
- b28dd0e
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
icbd.8
rb28dd0e r3dba97d 27 27 .Fl G Ar group1 Ns Op , Ns Ar ... 28 28 .Oc 29 .Op Fl L Ar prefix 29 30 .Op Fl M Ar modtab 30 31 .Op Fl S Ar name … … 67 68 .Nm 68 69 to create specified groups at startup. 70 .It Fl L Ar prefix 71 Enables logging of all public messages in all groups and specifies a 72 directory inside the chroot that is owned and is writable by the 73 .Nm 74 user. 75 The server will create subdirectories matching those of the group names 76 and place log files inside one file per month. 69 77 .It Fl M Ar modtab 70 78 Specifies a moderator table that can be used to restrict users who -
icbd.c
rb28dd0e r3dba97d 43 43 #include "icbd.h" 44 44 45 extern char *__progname;46 47 45 uint64_t sessionid; 48 46 char modtab[ICB_MTABLEN][ICB_MAXNICKLEN]; … … 51 49 int creategroups; 52 50 int foreground; 51 char logprefix[MAXPATHLEN/2]; 52 int dologging; 53 53 int verbose; 54 54 … … 84 84 icb_init(&ic); 85 85 86 while ((ch = getopt(argc, argv, "46CdG:M: S:v")) != -1)86 while ((ch = getopt(argc, argv, "46CdG:M:L:S:v")) != -1) 87 87 switch (ch) { 88 88 case '4': … … 100 100 case 'G': 101 101 icbd_grplist(optarg); 102 break; 103 case 'L': 104 strlcpy(logprefix, optarg, sizeof logprefix); 105 dologging++; 102 106 break; 103 107 case 'M': … … 301 305 usage(void) 302 306 { 307 extern char *__progname; 308 303 309 (void)fprintf(stderr, "usage: %s [-46Cdv] [-G group1[,group2,...]] " 304 "[-M modtab]\n\t[-S name] [[addr][:port] ...]\n", __progname); 310 "[-L prefix] [-M modtab]\n\t[-S name] [[addr][:port] ...]\n", 311 __progname); 305 312 exit(EX_USAGE); 306 313 } -
logger.c
rb28dd0e r3dba97d 60 60 struct event ev_tick; 61 61 62 extern char logprefix[MAXPATHLEN/2]; 63 extern int dologging; 64 62 65 int 63 66 logger_init(void) … … 177 180 FILE *fp = NULL; 178 181 179 if (mkdir(group, 0755) < 0 && errno != EEXIST) { 182 snprintf(path, sizeof path, "%s/%s", logprefix, group); 183 if (mkdir(path, 0755) < 0 && errno != EEXIST) { 180 184 syslog(LOG_ERR, "%s: %m", group); 181 185 return (NULL); 182 186 } 183 snprintf(path, sizeof path, "%s/%s ", group, file_ts);187 snprintf(path, sizeof path, "%s/%s/%s", logprefix, group, file_ts); 184 188 if ((fp = fopen(path, "a")) == NULL) { 185 189 syslog(LOG_ERR, "%s: %m", path); … … 200 204 struct iovec iov[2]; 201 205 206 if (!dologging) 207 return; 208 202 209 strlcpy(e.group, group, ICB_MAXGRPLEN); 203 210 strlcpy(e.nick, nick, ICB_MAXNICKLEN);
Note:
See TracChangeset
for help on using the changeset viewer.