Fixed filemode send to 0644

This commit is contained in:
Michiel Broek 2004-11-26 20:17:38 +00:00
parent 6b2a1f0d15
commit 1500b2a7c2
2 changed files with 26 additions and 5 deletions

View File

@ -516,6 +516,21 @@ int procheader(char *Name)
/* set default parameters and overrides */
openmode = (char *)"w";
/*
* Check slashes in the name
*/
p = strrchr(Name,'/');
if (p) {
p++;
if (!*p) {
/* alert - file name ended in with a / */
Syslog('!', "%s: file name ends with a /, skipped: %s", protname(), Name);
return ERROR;
}
Name = p;
Syslog('z', "filename converted to \"%s\"", MBSE_SS(Name));
}
Syslog('z', "zmanag=%d", zmanag);
Syslog('z', "zconv=%d", zconv);
@ -537,10 +552,12 @@ int procheader(char *Name)
Eofseen = FALSE;
p = Name + 1 + strlen(Name);
// FIXME: Here we must add code that checks the Name for slashes, spaces and other
// illegal characters in the filename.
sscanf(p, "%ld%lo%o%o%d%d%d%d", &Bytesleft, &Modtime, &Filemode, &dummy, &dummy, &dummy, &dummy, &dummy);
strcpy(ctt, rfcdate(Modtime));
if (*p) { /* file coming from Unix or DOS system */
sscanf(p, "%ld%lo%o%o%d%d%d%d", &Bytesleft, &Modtime, &Filemode, &dummy, &dummy, &dummy, &dummy, &dummy);
strcpy(ctt, rfcdate(Modtime));
} else {
Syslog('z', "File coming from a CP/M system");
}
Syslog('+', "%s: \"%s\" %ld bytes, %s mode %o", protname(), Name, Bytesleft, ctt, Filemode);
if (curfile)

View File

@ -213,7 +213,11 @@ static int sendzfile(char *rn)
Syslog('+', "Zmodem: size %lu bytes, dated %s", (unsigned long)st.st_size, rfcdate(st.st_mtime));
gettimeofday(&starttime, &tz);
sprintf(txbuf,"%s %lu %lo %o 0 0 0", rn,(unsigned long)st.st_size, st.st_mtime+(st.st_mtime%2), st.st_mode);
/*
* Filemode is fixed to 100644, we don't care how it is stored in the filebase.
*/
sprintf(txbuf,"%s %lu %lo 100644 0 0 0", rn,(unsigned long)st.st_size, st.st_mtime+(st.st_mtime%2));
Syslog('z', "txbuf \"%s\"", txbuf);
bufl = strlen(txbuf);
*(strchr(txbuf,' ')) = '\0'; /*hope no blanks in filename*/