Fix all (hopefully) occurencies of strcat and strncat which may cause buffer overflows
This commit is contained in:
parent
538a1d7696
commit
8e9c1edb36
@ -42,15 +42,15 @@
|
|||||||
int
|
int
|
||||||
generateBuildInfo(struct configTag *configtag, int arch)
|
generateBuildInfo(struct configTag *configtag, int arch)
|
||||||
{
|
{
|
||||||
char foutname[1024], fsourcesname[1024], fdir[1024];
|
char foutname[PATH_MAX], fsourcesname[PATH_MAX], fdir[PATH_MAX];
|
||||||
FILE *fout, *fsources;
|
FILE *fout, *fsources;
|
||||||
int i, j;
|
int i, j;
|
||||||
struct headerSourceList *currheadersourcelist;
|
struct headerSourceList *currheadersourcelist;
|
||||||
struct headerList *currchild;
|
struct headerList *currchild;
|
||||||
|
|
||||||
strncpy(fdir, configtag->repository_source_dir, 1024);
|
snprintf(fdir, sizeof(fdir), "%s", configtag->repository_source_dir);
|
||||||
strncpy(fsourcesname, fdir, 1024);
|
strncpy(fsourcesname, fdir, sizeof(fsourcesname));
|
||||||
strncat(fsourcesname, "buildinfo/sources.dat", 1024);
|
strncat(fsourcesname, "buildinfo/sources.dat", sizeof(fsourcesname) - strlen(fsourcesname));
|
||||||
|
|
||||||
if ((fsources = fopen(fsourcesname, "w")) == NULL) {
|
if ((fsources = fopen(fsourcesname, "w")) == NULL) {
|
||||||
perror(fsourcesname);
|
perror(fsourcesname);
|
||||||
@ -59,10 +59,10 @@ generateBuildInfo(struct configTag *configtag, int arch)
|
|||||||
|
|
||||||
currheadersourcelist = configtag->headersourcelist;
|
currheadersourcelist = configtag->headersourcelist;
|
||||||
while (currheadersourcelist) {
|
while (currheadersourcelist) {
|
||||||
strncpy(foutname, fdir, 1024);
|
strncpy(foutname, fdir, sizeof(foutname));
|
||||||
strncat(foutname, "buildinfo/", 1024);
|
strncat(foutname, "buildinfo/", sizeof(foutname) - strlen(foutname));
|
||||||
strncat(foutname, currheadersourcelist->name, 1024);
|
strncat(foutname, currheadersourcelist->name, sizeof(foutname) - strlen(foutname));
|
||||||
strncat(foutname, ".info", 1024);
|
strncat(foutname, ".info", sizeof(foutname) - strlen(foutname));
|
||||||
|
|
||||||
if ((fout = fopen(foutname, "w")) == NULL) {
|
if ((fout = fopen(foutname, "w")) == NULL) {
|
||||||
perror(foutname);
|
perror(foutname);
|
||||||
|
@ -937,7 +937,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
int i = 0,hasbuilds[ARCHS_MAX],ptharg[ARCHS_MAX];
|
int i = 0,hasbuilds[ARCHS_MAX],ptharg[ARCHS_MAX];
|
||||||
pthread_t pth[ARCHS_MAX];
|
pthread_t pth[ARCHS_MAX];
|
||||||
char warning[PATH_MAX];
|
char warning[8096];
|
||||||
|
|
||||||
time_t start_time, stop_time;
|
time_t start_time, stop_time;
|
||||||
|
|
||||||
@ -1139,7 +1139,7 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
warning[0]=0;
|
warning[0]=0;
|
||||||
for (i = 0; i < ARCHS_MAX && configtag->arch[i]; i++) {
|
for (i = 0; i < ARCHS_MAX && configtag->arch[i]; i++) {
|
||||||
snprintf(&warning[strlen(warning)],PATH_MAX-strlen(warning)," %s", configtag->arch[i]);
|
snprintf(&warning[strlen(warning)],sizeof(warning)-strlen(warning)," %s", configtag->arch[i]);
|
||||||
}
|
}
|
||||||
if (!quietmode)
|
if (!quietmode)
|
||||||
fprintf(stdout, "Scanning binary packages for archs:%s...\n",warning);
|
fprintf(stdout, "Scanning binary packages for archs:%s...\n",warning);
|
||||||
@ -1174,8 +1174,8 @@ main(int argc, char *argv[])
|
|||||||
warning[0] = '\0';
|
warning[0] = '\0';
|
||||||
for (i = 0; i < ARCHS_MAX && configtag->arch[i]; i++) {
|
for (i = 0; i < ARCHS_MAX && configtag->arch[i]; i++) {
|
||||||
if (hasbuilds[i] == 1) {
|
if (hasbuilds[i] == 1) {
|
||||||
strncat(warning," ",PATH_MAX);
|
strncat(warning, " ", sizeof(warning) - strlen(warning));
|
||||||
strncat(warning,configtag->arch[i],PATH_MAX);
|
strncat(warning, configtag->arch[i], sizeof(warning) - strlen(warning));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (warning[0] == '\0') {
|
if (warning[0] == '\0') {
|
||||||
@ -1191,9 +1191,9 @@ main(int argc, char *argv[])
|
|||||||
if ((hasbuilds[i] == -1) &&
|
if ((hasbuilds[i] == -1) &&
|
||||||
(currheadersourcelist->altrepository == configtag->repository_level)) {
|
(currheadersourcelist->altrepository == configtag->repository_level)) {
|
||||||
if (warning[0] == '\0')
|
if (warning[0] == '\0')
|
||||||
strncat(warning, "requires port to arch(s):", PATH_MAX);
|
strncat(warning, "requires port to arch(s):", sizeof(warning) - strlen(warning));
|
||||||
strncat(warning," ",PATH_MAX);
|
strncat(warning," ", sizeof(warning) - strlen(warning));
|
||||||
strncat(warning,configtag->arch[i],PATH_MAX);
|
strncat(warning,configtag->arch[i], sizeof(warning) - strlen(warning));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (warning[0] != '\0') {
|
if (warning[0] != '\0') {
|
||||||
@ -1213,13 +1213,13 @@ main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (currrebuild) {
|
if (currrebuild) {
|
||||||
strncat(warning,"need to be rebuilt:", PATH_MAX);
|
strncat(warning,"need to be rebuilt:", sizeof(warning) - strlen(warning));
|
||||||
while (currrebuild) {
|
while (currrebuild) {
|
||||||
strncat(warning," ",PATH_MAX);
|
strncat(warning," ", sizeof(warning) - strlen(warning));
|
||||||
strncat(warning,currrebuild->sourceheader->name,PATH_MAX);
|
strncat(warning,currrebuild->sourceheader->name, sizeof(warning) - strlen(warning));
|
||||||
strncat(warning,"(",PATH_MAX);
|
strncat(warning,"(", sizeof(warning) - strlen(warning));
|
||||||
strncat(warning,currrebuild->provider->arch,PATH_MAX);
|
strncat(warning,currrebuild->provider->arch, sizeof(warning) - strlen(warning));
|
||||||
strncat(warning,")",PATH_MAX);
|
strncat(warning,")", sizeof(warning) - strlen(warning));
|
||||||
currrebuild = currrebuild->next;
|
currrebuild = currrebuild->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -409,7 +409,7 @@ int findFileIdFromPath(sqlite3 *db, char** path) {
|
|||||||
if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK && sqlite3_step(stmt1) == SQLITE_ROW) {
|
if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK && sqlite3_step(stmt1) == SQLITE_ROW) {
|
||||||
parent = sqlite3_column_int(stmt1,0);
|
parent = sqlite3_column_int(stmt1,0);
|
||||||
sqlite3_finalize(stmt1);
|
sqlite3_finalize(stmt1);
|
||||||
strcat(linkpath, "/");
|
strncat(linkpath, "/", strlen(*path) - strlen(linkpath));
|
||||||
strncat(linkpath, buffer, strlen(*path) - strlen(linkpath));
|
strncat(linkpath, buffer, strlen(*path) - strlen(linkpath));
|
||||||
printf("/<a href='javascript:distroquery_request(\"repository=%s&arch=%s&path=%s\")'>%s</a>",
|
printf("/<a href='javascript:distroquery_request(\"repository=%s&arch=%s&path=%s\")'>%s</a>",
|
||||||
query_repository, query_arch, linkpath, buffer);
|
query_repository, query_arch, linkpath, buffer);
|
||||||
@ -1558,10 +1558,10 @@ void parse_request_variables(char *data) {
|
|||||||
search_files = strstr(valuetok, "false") != valuetok;
|
search_files = strstr(valuetok, "false") != valuetok;
|
||||||
}
|
}
|
||||||
if (vartok && valuetok) {
|
if (vartok && valuetok) {
|
||||||
strcat(query_next, vartok);
|
strncat(query_next, vartok, sizeof(query_next) - strlen(query_next));
|
||||||
strcat(query_next, "=");
|
strncat(query_next, "=", sizeof(query_next) - strlen(query_next));
|
||||||
strcat(query_next, valuetok);
|
strncat(query_next, valuetok, sizeof(query_next) - strlen(query_next));
|
||||||
strcat(query_next, "&");
|
strncat(query_next, "&", sizeof(query_next) - strlen(query_next));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -172,8 +172,8 @@ struct configTag* read_configuration(const char *confFile)
|
|||||||
|
|
||||||
if (configdefaults.html_basedir) {
|
if (configdefaults.html_basedir) {
|
||||||
strncpy(buf, configdefaults.html_basedir, PATH_MAX);
|
strncpy(buf, configdefaults.html_basedir, PATH_MAX);
|
||||||
strncat(buf, newconfigtag->tag, PATH_MAX);
|
strncat(buf, newconfigtag->tag, sizeof(buf) - strlen(buf));
|
||||||
strncat(buf, "/", PATH_MAX);
|
strncat(buf, "/", sizeof(buf) - strlen(buf));
|
||||||
newconfigtag->html_dir = (char *) strdup(buf);
|
newconfigtag->html_dir = (char *) strdup(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,7 +326,7 @@ struct configTag* read_configuration(const char *confFile)
|
|||||||
|
|
||||||
if (!currconfigtag->repository_source_dir) {
|
if (!currconfigtag->repository_source_dir) {
|
||||||
strncpy(buf, currconfigtag->repository_dir, PATH_MAX);
|
strncpy(buf, currconfigtag->repository_dir, PATH_MAX);
|
||||||
strncat(buf, "/SRPMS.base/", PATH_MAX);
|
strncat(buf, "/SRPMS.base/", sizeof(buf) - strlen(buf));
|
||||||
currconfigtag->repository_source_dir =
|
currconfigtag->repository_source_dir =
|
||||||
(char *) strdup(buf);
|
(char *) strdup(buf);
|
||||||
}
|
}
|
||||||
@ -402,11 +402,11 @@ void logmsg(int level, const char *msg, ...) {
|
|||||||
va_list ap;
|
va_list ap;
|
||||||
static char oldmsg[20][256];
|
static char oldmsg[20][256];
|
||||||
static int curroldmsg = 0;
|
static int curroldmsg = 0;
|
||||||
char newmsg[1024];
|
char newmsg[PATH_MAX];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
va_start(ap, msg);
|
va_start(ap, msg);
|
||||||
vsnprintf((char*)&newmsg, 1024, msg, ap);
|
vsnprintf((char*)&newmsg, PATH_MAX, msg, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
for (i = 0; i < 20; i++) {
|
for (i = 0; i < 20; i++) {
|
||||||
|
@ -65,7 +65,7 @@
|
|||||||
int rpmselector(const struct dirent *entry);
|
int rpmselector(const struct dirent *entry);
|
||||||
int sourcerpmselector(const struct dirent *entry);
|
int sourcerpmselector(const struct dirent *entry);
|
||||||
|
|
||||||
const int bufsize = 1024;
|
const int bufsize = PATH_MAX;
|
||||||
|
|
||||||
struct warningList* addWarning(struct headerSourceList *pkg, char* text)
|
struct warningList* addWarning(struct headerSourceList *pkg, char* text)
|
||||||
{
|
{
|
||||||
@ -534,7 +534,7 @@ findOrCreateFileTreeEntry(struct fileTree* *first,char* findname, int arch)
|
|||||||
{
|
{
|
||||||
struct fileTree *currdir,*prevdir=NULL;
|
struct fileTree *currdir,*prevdir=NULL;
|
||||||
char *pstart,*pend;
|
char *pstart,*pend;
|
||||||
char f[1024];
|
char f[PATH_MAX];
|
||||||
int l;
|
int l;
|
||||||
|
|
||||||
currdir = *first;
|
currdir = *first;
|
||||||
|
@ -84,7 +84,7 @@ int
|
|||||||
printHTMLWarnings(FILE *fout, struct configTag *configtag, struct headerSourceList* pkg, int mode) {
|
printHTMLWarnings(FILE *fout, struct configTag *configtag, struct headerSourceList* pkg, int mode) {
|
||||||
|
|
||||||
char warningsfile[PATH_MAX];
|
char warningsfile[PATH_MAX];
|
||||||
char buf[1024];
|
char buf[PATH_MAX];
|
||||||
struct stat s;
|
struct stat s;
|
||||||
FILE *fin;
|
FILE *fin;
|
||||||
int n;
|
int n;
|
||||||
@ -122,7 +122,7 @@ printHTMLWarnings(FILE *fout, struct configTag *configtag, struct headerSourceLi
|
|||||||
|
|
||||||
fprintf(fout," • Comment:");
|
fprintf(fout," • Comment:");
|
||||||
while (!feof(fin)) {
|
while (!feof(fin)) {
|
||||||
n = fread(buf,1,1024,fin);
|
n = fread(buf, 1, sizeof(buf), fin);
|
||||||
fwrite(buf,1,n,fout);
|
fwrite(buf,1,n,fout);
|
||||||
}
|
}
|
||||||
if (mode == 0) {
|
if (mode == 0) {
|
||||||
@ -223,7 +223,7 @@ void printpkgicon(FILE *fout, struct configTag *configtag, struct headerSourceLi
|
|||||||
int
|
int
|
||||||
generateMaintainersPages(struct configTag *configtag)
|
generateMaintainersPages(struct configTag *configtag)
|
||||||
{
|
{
|
||||||
char idxfile[1024],outfile[1024],unmaintfile[1024];
|
char idxfile[PATH_MAX],outfile[PATH_MAX],unmaintfile[PATH_MAX];
|
||||||
FILE *idx=NULL,*out=NULL,*unmaint=NULL;
|
FILE *idx=NULL,*out=NULL,*unmaint=NULL;
|
||||||
int i,pkgnum,unmaintpkgnum;
|
int i,pkgnum,unmaintpkgnum;
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
@ -234,7 +234,7 @@ generateMaintainersPages(struct configTag *configtag)
|
|||||||
configtag->stats.headersourcecount, sizeof(struct headerSourceList *),
|
configtag->stats.headersourcecount, sizeof(struct headerSourceList *),
|
||||||
comparePackagers);
|
comparePackagers);
|
||||||
|
|
||||||
snprintf(outfile,1024,"%smaintainers",configtag->html_dir);
|
snprintf(outfile, PATH_MAX, "%smaintainers", configtag->html_dir);
|
||||||
if (stat(outfile,&buf)) {
|
if (stat(outfile,&buf)) {
|
||||||
if (mkdir(outfile,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
|
if (mkdir(outfile,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
|
||||||
logmsg(LOG_ERROR,"cannot create %s directory; aborting.",outfile);
|
logmsg(LOG_ERROR,"cannot create %s directory; aborting.",outfile);
|
||||||
@ -247,7 +247,7 @@ generateMaintainersPages(struct configTag *configtag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(idxfile,1024,"%s_maintainers.inc",configtag->html_dir);
|
snprintf(idxfile, PATH_MAX, "%s_maintainers.inc", configtag->html_dir);
|
||||||
|
|
||||||
if ((idx = fopen(idxfile, "w")) == NULL) {
|
if ((idx = fopen(idxfile, "w")) == NULL) {
|
||||||
perror(idxfile);
|
perror(idxfile);
|
||||||
@ -259,7 +259,7 @@ generateMaintainersPages(struct configTag *configtag)
|
|||||||
configtag->tag,
|
configtag->tag,
|
||||||
configtag->description);
|
configtag->description);
|
||||||
|
|
||||||
snprintf(unmaintfile,1024,"%smaintainers/unmaintained.inc",configtag->html_dir);
|
snprintf(unmaintfile, PATH_MAX, "%smaintainers/unmaintained.inc", configtag->html_dir);
|
||||||
|
|
||||||
if ((unmaint = fopen(unmaintfile, "w")) == NULL) {
|
if ((unmaint = fopen(unmaintfile, "w")) == NULL) {
|
||||||
perror(unmaintfile);
|
perror(unmaintfile);
|
||||||
@ -283,7 +283,7 @@ generateMaintainersPages(struct configTag *configtag)
|
|||||||
if ((configtag->stats.headersourcelistvec[i])->packager->role &
|
if ((configtag->stats.headersourcelistvec[i])->packager->role &
|
||||||
PACKAGER_ROLE_MAINTAINER) {
|
PACKAGER_ROLE_MAINTAINER) {
|
||||||
|
|
||||||
snprintf(outfile,1024,"%smaintainers/%s.inc",
|
snprintf(outfile, PATH_MAX, "%smaintainers/%s.inc",
|
||||||
configtag->html_dir,
|
configtag->html_dir,
|
||||||
(configtag->stats.headersourcelistvec[i])->packager->name);
|
(configtag->stats.headersourcelistvec[i])->packager->name);
|
||||||
|
|
||||||
@ -380,8 +380,8 @@ generateMaintainersPages(struct configTag *configtag)
|
|||||||
int
|
int
|
||||||
generateStats(struct configTag *configtag,int arch)
|
generateStats(struct configTag *configtag,int arch)
|
||||||
{
|
{
|
||||||
char outfile[1024];
|
char outfile[PATH_MAX];
|
||||||
char rssfile[1024];
|
char rssfile[PATH_MAX];
|
||||||
char buffer[PATH_MAX];
|
char buffer[PATH_MAX];
|
||||||
FILE *htmlout=NULL,*htmloldout,*rssout,*groupout;
|
FILE *htmlout=NULL,*htmloldout,*rssout,*groupout;
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
@ -410,7 +410,7 @@ generateStats(struct configTag *configtag,int arch)
|
|||||||
configtag->stats.headersourcecount, sizeof(struct headerSourceList *),
|
configtag->stats.headersourcecount, sizeof(struct headerSourceList *),
|
||||||
compareGroup);
|
compareGroup);
|
||||||
|
|
||||||
snprintf(outfile,1024,"%s_groups.inc",configtag->html_dir);
|
snprintf(outfile, PATH_MAX, "%s_groups.inc", configtag->html_dir);
|
||||||
|
|
||||||
if ((groupout = fopen(outfile, "w")) == NULL) {
|
if ((groupout = fopen(outfile, "w")) == NULL) {
|
||||||
perror(outfile);
|
perror(outfile);
|
||||||
@ -457,7 +457,7 @@ generateStats(struct configTag *configtag,int arch)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
strncat(outfile, "/_index.inc", 1024);
|
strncat(outfile, "/_index.inc", sizeof(outfile) - strlen(outfile));
|
||||||
if ((htmlout = fopen(outfile, "w")) == NULL) {
|
if ((htmlout = fopen(outfile, "w")) == NULL) {
|
||||||
perror(outfile);
|
perror(outfile);
|
||||||
return 1;
|
return 1;
|
||||||
@ -500,8 +500,8 @@ generateStats(struct configTag *configtag,int arch)
|
|||||||
fclose(groupout);
|
fclose(groupout);
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy(outfile, configtag->html_dir, 1024);
|
strncpy(outfile, configtag->html_dir, PATH_MAX);
|
||||||
strncat(outfile, "_recent.inc", 1024);
|
strncat(outfile, "_recent.inc", sizeof(outfile) - strlen(outfile));
|
||||||
if ((htmlout = fopen(outfile, "w")) == NULL) {
|
if ((htmlout = fopen(outfile, "w")) == NULL) {
|
||||||
perror(outfile);
|
perror(outfile);
|
||||||
return 1;
|
return 1;
|
||||||
@ -516,8 +516,8 @@ generateStats(struct configTag *configtag,int arch)
|
|||||||
fprintf(htmlout, "Recent builds:<br>\n");
|
fprintf(htmlout, "Recent builds:<br>\n");
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
strncpy(outfile, configtag->html_dir, 1024);
|
strncpy(outfile, configtag->html_dir, PATH_MAX);
|
||||||
strncat(outfile, "_oldest.inc", 1024);
|
strncat(outfile, "_oldest.inc", sizeof(outfile) - strlen(outfile));
|
||||||
if ((htmloldout = fopen(outfile, "w")) == NULL) {
|
if ((htmloldout = fopen(outfile, "w")) == NULL) {
|
||||||
perror(outfile);
|
perror(outfile);
|
||||||
return 1;
|
return 1;
|
||||||
@ -527,8 +527,8 @@ generateStats(struct configTag *configtag,int arch)
|
|||||||
fprintf(htmloldout, "Oldest builds:<br>\n");
|
fprintf(htmloldout, "Oldest builds:<br>\n");
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
strncpy(rssfile, configtag->html_dir, 1024);
|
strncpy(rssfile, configtag->html_dir, PATH_MAX);
|
||||||
strncat(rssfile, "recent.rss", 1024);
|
strncat(rssfile, "recent.rss", sizeof(rssfile) - strlen(rssfile));
|
||||||
if ((rssout = fopen(rssfile, "w")) == NULL) {
|
if ((rssout = fopen(rssfile, "w")) == NULL) {
|
||||||
perror(rssfile);
|
perror(rssfile);
|
||||||
return 1;
|
return 1;
|
||||||
@ -643,7 +643,7 @@ generateStats(struct configTag *configtag,int arch)
|
|||||||
fclose(rssout);
|
fclose(rssout);
|
||||||
|
|
||||||
/* create APT repository file */
|
/* create APT repository file */
|
||||||
snprintf(outfile,1024,"%s%s-%s.list",
|
snprintf(outfile, PATH_MAX, "%s%s-%s.list",
|
||||||
configtag->html_dir,
|
configtag->html_dir,
|
||||||
configtag->configdefaults->distribution_name,
|
configtag->configdefaults->distribution_name,
|
||||||
configtag->tag);
|
configtag->tag);
|
||||||
@ -683,7 +683,7 @@ generateStats(struct configTag *configtag,int arch)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* create Smart Package Manager channel file */
|
/* create Smart Package Manager channel file */
|
||||||
snprintf(outfile,1024,"%s%s-%s.smart",
|
snprintf(outfile, PATH_MAX, "%s%s-%s.smart",
|
||||||
configtag->html_dir,
|
configtag->html_dir,
|
||||||
configtag->configdefaults->distribution_name,
|
configtag->configdefaults->distribution_name,
|
||||||
configtag->tag);
|
configtag->tag);
|
||||||
@ -727,7 +727,7 @@ generateStats(struct configTag *configtag,int arch)
|
|||||||
tmdate.tm_mday = 1;
|
tmdate.tm_mday = 1;
|
||||||
tmdate.tm_mon = 0;
|
tmdate.tm_mon = 0;
|
||||||
|
|
||||||
snprintf(outfile,1024,"%s_changelog.inc",configtag->html_dir);
|
snprintf(outfile, PATH_MAX, "%s_changelog.inc", configtag->html_dir);
|
||||||
|
|
||||||
if ((htmlout = fopen(outfile, "w")) == NULL) {
|
if ((htmlout = fopen(outfile, "w")) == NULL) {
|
||||||
perror(outfile);
|
perror(outfile);
|
||||||
@ -757,7 +757,7 @@ generateHTMLMainIndex(struct configTag *configtag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
strncpy(indexfile, configtag->configdefaults->html_basedir, PATH_MAX);
|
strncpy(indexfile, configtag->configdefaults->html_basedir, PATH_MAX);
|
||||||
strncat(indexfile, "_index.inc", PATH_MAX);
|
strncat(indexfile, "_index.inc", sizeof(indexfile) - strlen(indexfile));
|
||||||
|
|
||||||
if ((fout = fopen(indexfile, "w")) == NULL) {
|
if ((fout = fopen(indexfile, "w")) == NULL) {
|
||||||
perror(indexfile);
|
perror(indexfile);
|
||||||
@ -846,7 +846,7 @@ generateHTML_SRPMSFiles(struct configTag *configtag)
|
|||||||
char indexfile[PATH_MAX];
|
char indexfile[PATH_MAX];
|
||||||
char htmlfile[PATH_MAX];
|
char htmlfile[PATH_MAX];
|
||||||
char warningsdir[PATH_MAX];
|
char warningsdir[PATH_MAX];
|
||||||
char buffer[PATH_MAX],buffer2[1024];
|
char buffer[PATH_MAX],buffer2[PATH_MAX];
|
||||||
int c,i,j,arch,idx;
|
int c,i,j,arch,idx;
|
||||||
char *st;
|
char *st;
|
||||||
char curr_letter,curr_anchor ='a'-1;
|
char curr_letter,curr_anchor ='a'-1;
|
||||||
@ -955,7 +955,7 @@ generateHTML_SRPMSFiles(struct configTag *configtag)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
get_favicon_from_url(currheadersourcelist->url,buffer2,1024);
|
get_favicon_from_url(currheadersourcelist->url, buffer2, PATH_MAX);
|
||||||
|
|
||||||
fprintf(fout,
|
fprintf(fout,
|
||||||
"<h1><img src=\"%s\" width=\"16\" height=\"16\">"
|
"<h1><img src=\"%s\" width=\"16\" height=\"16\">"
|
||||||
@ -989,7 +989,7 @@ generateHTML_SRPMSFiles(struct configTag *configtag)
|
|||||||
"<tr><td>Group:</td><td><a href=\"%stag=%s&group=%s\">%s</a></td></tr>\n",
|
"<tr><td>Group:</td><td><a href=\"%stag=%s&group=%s\">%s</a></td></tr>\n",
|
||||||
configtag->configdefaults->url_prefix,
|
configtag->configdefaults->url_prefix,
|
||||||
configtag->tag,
|
configtag->tag,
|
||||||
groupdirname(currheadersourcelist->group,buffer2,1024),
|
groupdirname(currheadersourcelist->group, buffer2, PATH_MAX),
|
||||||
htmlclean(currheadersourcelist->group,buffer,PATH_MAX));
|
htmlclean(currheadersourcelist->group,buffer,PATH_MAX));
|
||||||
|
|
||||||
fprintf(fout,
|
fprintf(fout,
|
||||||
@ -1426,7 +1426,7 @@ generateHTMLFiles(struct configTag *ct, int arch)
|
|||||||
perror(htmlfile);
|
perror(htmlfile);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
get_favicon_from_url(currheaderlist->sourceheader->url,buffer,1024);
|
get_favicon_from_url(currheaderlist->sourceheader->url, buffer, PATH_MAX);
|
||||||
|
|
||||||
fprintf(fout,
|
fprintf(fout,
|
||||||
"<h1><img src=\"%s\" width=\"16\" height=\"16\">"
|
"<h1><img src=\"%s\" width=\"16\" height=\"16\">"
|
||||||
@ -1751,8 +1751,8 @@ void print_contents_subtree(FILE *f,
|
|||||||
(ft->provider[k]->altrepository == ct->repository_level))) {
|
(ft->provider[k]->altrepository == ct->repository_level))) {
|
||||||
ftname(ft,buf,bufsize);
|
ftname(ft,buf,bufsize);
|
||||||
if ((j=strlen(buf)) < 60) {
|
if ((j=strlen(buf)) < 60) {
|
||||||
for (i=(60-j)/8; i>0; i--) strncat(buf,"\t",1024);
|
for (i=(60-j)/8; i>0; i--) strncat(buf, "\t", bufsize - strlen(buf));
|
||||||
while (strlen(buf) < 60) strncat(buf," ",1024);
|
while (strlen(buf) < 60) strncat(buf, " ", bufsize - strlen(buf));
|
||||||
}
|
}
|
||||||
fprintf(f, "%s %s/%s\n",buf,ct->tag,ft->provider[0]->name);
|
fprintf(f, "%s %s/%s\n",buf,ct->tag,ft->provider[0]->name);
|
||||||
}
|
}
|
||||||
@ -1768,23 +1768,23 @@ int
|
|||||||
print_datatables(struct configTag *ct, int arch) {
|
print_datatables(struct configTag *ct, int arch) {
|
||||||
|
|
||||||
FILE *fbd,*fd,*fv,*fb,*fbsh,*fs,*fc,*fw;
|
FILE *fbd,*fd,*fv,*fb,*fbsh,*fs,*fc,*fw;
|
||||||
char builddeps_filename[1024], deps_filename[1024], virtual_filename[1024],
|
char builddeps_filename[PATH_MAX], deps_filename[PATH_MAX], virtual_filename[PATH_MAX],
|
||||||
builds_filename[1024], builds_sh_filename[1024], sources_filename[1024],
|
builds_filename[PATH_MAX], builds_sh_filename[PATH_MAX], sources_filename[PATH_MAX],
|
||||||
contents_filename[1024], warnings_filename[1024], buf[1024];
|
contents_filename[PATH_MAX], warnings_filename[PATH_MAX], buf[PATH_MAX];
|
||||||
char obsoletebuf[PATH_MAX];
|
char obsoletebuf[PATH_MAX];
|
||||||
struct headerList *currheaderlist, *currchild;
|
struct headerList *currheaderlist, *currchild;
|
||||||
struct headerSourceList *currheadersourcelist, *oldheadersourcelist;
|
struct headerSourceList *currheadersourcelist, *oldheadersourcelist;
|
||||||
struct rebuildList *currrebuild;
|
struct rebuildList *currrebuild;
|
||||||
int i, nonobsoletednumproviders;
|
int i, nonobsoletednumproviders;
|
||||||
|
|
||||||
snprintf(builddeps_filename,1024,"%sbuilddeps-%s",ct->html_dir,ct->arch[arch]);
|
snprintf(builddeps_filename, PATH_MAX, "%sbuilddeps-%s", ct->html_dir, ct->arch[arch]);
|
||||||
snprintf(deps_filename,1024,"%sdeps-%s",ct->html_dir,ct->arch[arch]);
|
snprintf(deps_filename, PATH_MAX, "%sdeps-%s", ct->html_dir, ct->arch[arch]);
|
||||||
snprintf(virtual_filename,1024,"%svirtual-%s",ct->html_dir,ct->arch[arch]);
|
snprintf(virtual_filename, PATH_MAX, "%svirtual-%s", ct->html_dir, ct->arch[arch]);
|
||||||
snprintf(builds_filename,1024,"%sbuilds-%s",ct->html_dir,ct->arch[arch]);
|
snprintf(builds_filename, PATH_MAX, "%sbuilds-%s", ct->html_dir, ct->arch[arch]);
|
||||||
snprintf(builds_sh_filename,1024,"%sbuilds-%s.sh",ct->html_dir,ct->arch[arch]);
|
snprintf(builds_sh_filename, PATH_MAX, "%sbuilds-%s.sh", ct->html_dir, ct->arch[arch]);
|
||||||
snprintf(sources_filename,1024,"%ssources-%s",ct->html_dir,ct->arch[arch]);
|
snprintf(sources_filename, PATH_MAX, "%ssources-%s", ct->html_dir, ct->arch[arch]);
|
||||||
snprintf(contents_filename,1024,"%scontentslist-%s",ct->repository_dir,ct->arch[arch]);
|
snprintf(contents_filename, PATH_MAX, "%scontentslist-%s", ct->repository_dir, ct->arch[arch]);
|
||||||
snprintf(warnings_filename,1024,"%swarnings-%s",ct->repository_dir,ct->arch[arch]);
|
snprintf(warnings_filename, PATH_MAX, "%swarnings-%s", ct->repository_dir, ct->arch[arch]);
|
||||||
|
|
||||||
fbd=fopen(builddeps_filename,"w");
|
fbd=fopen(builddeps_filename,"w");
|
||||||
if (!fbd) {
|
if (!fbd) {
|
||||||
@ -1935,7 +1935,7 @@ print_datatables(struct configTag *ct, int arch) {
|
|||||||
|
|
||||||
//write contents (filenames)
|
//write contents (filenames)
|
||||||
logmsg(LOG_DEBUG,"writing contents file");
|
logmsg(LOG_DEBUG,"writing contents file");
|
||||||
print_contents_subtree(fc,ct->filetree[arch],ct,buf,1024);
|
print_contents_subtree(fc, ct->filetree[arch], ct, buf, PATH_MAX);
|
||||||
|
|
||||||
logmsg(LOG_DEBUG,"writing deps files (2)");
|
logmsg(LOG_DEBUG,"writing deps files (2)");
|
||||||
currheaderlist = ct->headerlist[arch];
|
currheaderlist = ct->headerlist[arch];
|
||||||
@ -2045,10 +2045,10 @@ print_datatables(struct configTag *ct, int arch) {
|
|||||||
|
|
||||||
if (currchild) {
|
if (currchild) {
|
||||||
|
|
||||||
if (!strncmp(currheadersourcelist->arch,"noarch",1024))
|
if (!strncmp(currheadersourcelist->arch, "noarch", PATH_MAX))
|
||||||
snprintf(obsoletebuf,1024,"noarch");
|
snprintf(obsoletebuf, PATH_MAX, "noarch");
|
||||||
else
|
else
|
||||||
snprintf(obsoletebuf,1024,"%s",ct->arch[arch]);
|
snprintf(obsoletebuf, PATH_MAX, "%s", ct->arch[arch]);
|
||||||
fprintf(fbsh,"[ \"$pkg\" = \"%s\" ] && { pkg_header=(%s %s %s %s \"%s\" \"%s\" %ld %ld %d %s); ",
|
fprintf(fbsh,"[ \"$pkg\" = \"%s\" ] && { pkg_header=(%s %s %s %s \"%s\" \"%s\" %ld %ld %d %s); ",
|
||||||
currheadersourcelist->name,
|
currheadersourcelist->name,
|
||||||
currheadersourcelist->name,
|
currheadersourcelist->name,
|
||||||
@ -2080,8 +2080,8 @@ print_datatables(struct configTag *ct, int arch) {
|
|||||||
currheadersourcelist->name, PATH_MAX);
|
currheadersourcelist->name, PATH_MAX);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (obsoletebuf[0] != '\0') strcat(obsoletebuf," ");
|
if (obsoletebuf[0] != '\0') strncat(obsoletebuf, " ", sizeof(obsoletebuf) - strlen(obsoletebuf));
|
||||||
strcat(obsoletebuf,currchild->obsoletename[i]);
|
strncat(obsoletebuf, currchild->obsoletename[i], sizeof(obsoletebuf) - strlen(obsoletebuf));
|
||||||
}
|
}
|
||||||
currchild = currchild->nextbrother;
|
currchild = currchild->nextbrother;
|
||||||
if (currchild) fprintf(fbsh," ");
|
if (currchild) fprintf(fbsh," ");
|
||||||
|
Loading…
Reference in New Issue
Block a user