if(ConfigFile[0] == '\0') sprintf(ConfigFile,"%s/sarg.conf",SYSCONFDIR);
if(access(ConfigFile, R_OK) != 0) {
- sprintf(msg,"Cannot open config file: %s - %s",ConfigFile,strerror(errno));
- debuga(msg);
+ debuga("Cannot open config file: %s - %s",ConfigFile,strerror(errno));
exit(1);
}
strcpy(hexclude,ExcludeHosts);
if(strlen(hexclude) > 0) {
if(access(hexclude, R_OK) != 0) {
- sprintf(msg,"Cannot open exclude_hosts file: %s - %s",hexclude,strerror(errno));
- debuga(msg);
+ debuga("Cannot open exclude_hosts file: %s - %s",hexclude,strerror(errno));
exit(1);
}
gethexclude(hexclude,debug);
printf("Language=%s\n\n",text[3]);
}
- if(debug){
- sprintf(msg,"sarg %s: %s",text[73],VERSION);
- debuga(msg);
- }
+ if(debug)
+ debuga("sarg %s: %s",text[73],VERSION);
if (strlen(Ulimit) > 0) {
#if defined(RLIMIT_NOFILE)
#elif defined(RLIMIT_OFILE)
if(setrlimit (RLIMIT_OFILE, &rl) == -1) {
#endif
- sprintf(msg,"setrlimit error - %s\n",strerror(errno));
- debuga(msg);
+ debuga("setrlimit error - %s\n",strerror(errno));
}
}
- if(debug) {
- sprintf(msg,"Maximum file descriptor: cur=%ld max=%ld, changed to cur="RLIM_STRING" max="RLIM_STRING,l1,l2,rl.rlim_cur,rl.rlim_max);
- debuga(msg);
- }
+ if(debug)
+ debuga("Maximum file descriptor: cur=%ld max=%ld, changed to cur="RLIM_STRING" max="RLIM_STRING,l1,l2,rl.rlim_cur,rl.rlim_max);
}
read_usertab(UserTabFile);
strcpy(arqtt,arq);
decomp(arq,zip,tmp);
- if(debug) {
- sprintf(msg, "%s: %s",text[7],arq);
- debuga(msg);
- }
+ if(debug)
+ debuga("%s: %s",text[7],arq);
if((fp_in=MY_FOPEN(arq,"r"))==NULL) {
fprintf(stderr, "%s: (log) %s: %s - %s\n",argv[0],text[8],arq,strerror(errno));
tt=atoi(data);
t=localtime(&tt);
- strftime(tbuf2, 127, "%H%M", t);
+ strftime(tbuf2, sizeof(tbuf2), "%H%M", t);
if(strncmp(df,"u",1) == 0)
- strftime(tbuf, 127, "%Y%b%d", t);
+ strftime(tbuf, sizeof(tbuf), "%Y%b%d", t);
if(strncmp(df,"e",1) == 0)
- strftime(tbuf, 127, "%d%b%Y", t);
+ strftime(tbuf, sizeof(tbuf), "%d%b%Y", t);
if(strncmp(df,"w",1) == 0) {
strcpy(IndexTree,"file");
- strftime(tbuf, 127, "%Y.%U", t);
+ strftime(tbuf, sizeof(tbuf), "%Y.%U", t);
}
- strftime(dia, 127, "%d/%m/%Y", t);
- strftime(wdata, 127, "%Y%m%d", t);
+ strftime(dia, sizeof(dia), "%d/%m/%Y", t);
+ strftime(wdata, sizeof(wdata), "%Y%m%d", t);
idata=atoi(wdata);
if(strncmp(df,"u",1)==0)
- strftime(dia, 127, "%m/%d/%Y", t);
+ strftime(dia, sizeof(dia), "%m/%d/%Y", t);
sprintf(hora,"%02d:%02d:%02d",t->tm_hour,t->tm_min,t->tm_sec);
} else {
strcpy(wtemp,data+1);
}
if(strcmp(df,"u") == 0)
- sprintf(tbuf,"%s%s%s",ano,mes,dia);
+ snprintf(tbuf,sizeof(tbuf),"%s%s%s",ano,mes,dia);
if(strcmp(df,"e") == 0)
- sprintf(tbuf,"%s%s%s",dia,mes,ano);
+ snprintf(tbuf,sizeof(tbuf),"%s%s%s",dia,mes,ano);
builddia(dia,mes,ano,df,wdata);
idata=atoi(wdata);
}
fclose (fp_Write_User);
if(debug) {
- sprintf(msg, " %s: %ld, %s: %ld, %s: %ld",text[10],totregsl,text[11],totregsg,text[68],totregsx);
- debuga(msg);
+ debuga(" %s: %ld, %s: %ld, %s: %ld",text[10],totregsl,text[11],totregsg,text[68],totregsx);
if((common_log) && (squid_log))
- debuga(text[12]);
+ debuga("%s",text[12]);
if((common_log) && (!squid_log))
- debuga(text[13]);
+ debuga("%s",text[13]);
if((!common_log) && (squid_log))
- debuga(text[14]);
+ debuga("%s",text[14]);
if(sarglog)
- debuga(text[124]);
+ debuga("%s",text[124]);
if((!common_log) && (!squid_log) && (!sarglog) && (!isalog)) {
if(!totregsg) {
debugaz("period",period);
}
- if(debug){
- sprintf(msg, "%s: %s",text[17],period);
- debuga(msg);
- }
+ if(debug)
+ debuga("%s: %s",text[17],period);
fclose(fp_in);
// fclose(fp_ou);
}
}
- if(debug) {
- sprintf(msg,"%s %s",text[123],arq_log);
- debuga(msg);
- }
+ if(debug)
+ debuga("%s %s",text[123],arq_log);
}
if(strstr(ReportType,"denied") != 0) {
free(excludeuser);
if(debug)
- debuga(text[21]);
+ debuga("%s",text[21]);
exit(0);
FILE *fp_usr;
char buf[255];
- char Msg[255];
char *str;
unsigned long int nreg=0;
- if(debug) {
- sprintf(Msg,"%s: %s",text[60],pwdfile);
- debuga(Msg);
- }
+ if(debug)
+ debuga("%s: %s",text[60],pwdfile);
if ((fp_usr = fopen(pwdfile, "r")) == NULL) {
fprintf(stderr, "SARG: (getusers) %s: %s - %s\n",text[45],pwdfile,strerror(errno));
FILE *fp_ex;
char buf[255];
- char Msg[255];
unsigned long int nreg=0;
- if(debug) {
- sprintf(Msg,"%s: %s",text[67],hexfile);
- debuga(Msg);
- }
+ if(debug)
+ debuga("%s: %s",text[67],hexfile);
if ((fp_ex = fopen(hexfile, "r")) == NULL) {
fprintf(stderr, "SARG: (gethexclude) %s: %s - %s\n",text[45],hexfile,strerror(errno));
FILE *fp_ex;
char buf[255];
- char Msg[255];
unsigned long int nreg=0;
- if(debug) {
- sprintf(Msg,"%s: %s",text[67],uexfile);
- debuga(Msg);
- }
+ if(debug)
+ debuga("%s: %s",text[67],uexfile);
if ((fp_ex = fopen(uexfile, "r")) == NULL) {
fprintf(stderr, "SARG: (gethexclude) %s: %s - %s\n",text[45],uexfile,strerror(errno));