Skip to content
Snippets Groups Projects
Commit 9d7f48c6 authored by deuce's avatar deuce
Browse files

More 64-bit goodness. Conecntrating on time_t* issues.

parent 7359d2b3
No related branches found
No related tags found
No related merge requests found
......@@ -2565,7 +2565,7 @@ static void smtp_thread(void* arg)
safe_snprintf(str,sizeof(str)
,"\7\1n\1hOn %.24s\r\n\1m%s \1n\1msent you e-mail from: "
"\1h%s\1n\r\n"
,timestr(&scfg,(time_t*)&newmsg.hdr.when_imported.time,tmp)
,time32str(&scfg,&newmsg.hdr.when_imported.time,tmp)
,sender,sender_addr);
if(!newmsg.idx.to) { /* Forwarding */
strcat(str,"\1mand it was automatically forwarded to: \1h");
......
......@@ -45,14 +45,16 @@ char* DLLCALL msgdate(when_t when, char* buf)
struct tm tm;
char plus='+';
short tz;
time_t tt;
tz=smb_tzutc(when.zone);
if(tz<0) {
plus='-';
tz=-tz;
}
if(localtime_r((const time_t*)&when.time,&tm)==NULL)
tt=when.time;
if(localtime_r(&tt,&tm)==NULL)
memset(&tm,0,sizeof(tm));
sprintf(buf,"%s, %d %s %d %02d:%02d:%02d %c%02u%02u"
,wday[tm.tm_wday]
......
......@@ -510,13 +510,14 @@ char *binstr(uchar *buf, ushort length)
/* Generates a 24 character ASCII string that represents the time_t pointer */
/* Used as a replacement for ctime() */
/****************************************************************************/
char *my_timestr(time_t *intime)
char *my_timestr(time32_t *intime)
{
static char str[256];
char mer[3],hour;
struct tm *gm;
time_t tt=*intime;
gm=localtime(intime);
gm=localtime(&tt);
if(gm==NULL) {
strcpy(str,"Invalid Time");
return(str);
......@@ -559,7 +560,7 @@ void dumpindex(ulong start, ulong count)
printf("%4lu %04hX %04hX %04Xh %04Xh %06X %s\n"
,idx.number,idx.from,idx.to,idx.subj,idx.attr
,idx.offset,my_timestr((time_t*)&idx.time));
,idx.offset,my_timestr(&idx.time));
l++;
}
}
......@@ -625,7 +626,7 @@ void dump_hashes(void)
printf("%-10s: %lu\n", "Number", hash.number);
printf("%-10s: %s\n", "Source", smb_hashsourcetype(hash.source));
printf("%-10s: %lu\n", "Length", hash.length);
printf("%-10s: %s\n", "Time", my_timestr((time_t*)&hash.time));
printf("%-10s: %s\n", "Time", my_timestr(&hash.time));
printf("%-10s: %x\n", "Flags", hash.flags);
if(hash.flags&SMB_HASH_CRC16)
printf("%-10s: %04x\n", "CRC-16", hash.crc16);
......@@ -1337,7 +1338,7 @@ void readmsgs(ulong start)
if(msg.from_net.type)
printf(" (%s)",smb_netaddr(&msg.from_net));
printf("\nDate : %.24s %s"
,my_timestr((time_t*)&msg.hdr.when_written.time)
,my_timestr(&msg.hdr.when_written.time)
,smb_zonestr(msg.hdr.when_written.zone,NULL));
printf("\n\n");
......
......@@ -66,6 +66,7 @@ static char *binstr(uchar *buf, ushort length)
void SMBCALL smb_dump_msghdr(FILE* fp, smbmsg_t* msg)
{
int i;
time_t tt;
fprintf(fp,"%-20.20s %ld\n" ,"number" ,msg->hdr.number);
......@@ -100,17 +101,21 @@ void SMBCALL smb_dump_msghdr(FILE* fp, smbmsg_t* msg)
fprintf(fp,"%-20.20s %s\n" ,"summary" ,msg->summary);
/* convenience integers */
if(msg->expiration)
if(msg->expiration) {
tt=msg->expiration;
fprintf(fp,"%-20.20s %.24s\n","expiration"
,ctime((time_t *)&msg->expiration));
,ctime(&tt));
}
/* fixed header fields */
tt=msg->hdr.when_written.time;
fprintf(fp,"%-20.20s %.24s UTC%+d:%02d\n" ,"when_written"
,ctime((time_t *)&msg->hdr.when_written.time)
,ctime(&tt)
,smb_tzutc(msg->hdr.when_written.zone)/60
,abs(smb_tzutc(msg->hdr.when_written.zone)%60));
tt-msg->hdr.when_imported.time;
fprintf(fp,"%-20.20s %.24s UTC%+d:%02d\n" ,"when_imported"
,ctime((time_t *)&msg->hdr.when_imported.time)
,ctime(&tt)
,smb_tzutc(msg->hdr.when_imported.zone)/60
,abs(smb_tzutc(msg->hdr.when_imported.zone)%60));
fprintf(fp,"%-20.20s %04Xh\n" ,"type" ,msg->hdr.type);
......@@ -130,8 +135,10 @@ void SMBCALL smb_dump_msghdr(FILE* fp, smbmsg_t* msg)
fprintf(fp,"%-20.20s %hu\n" ,"delivery_attempts",msg->hdr.delivery_attempts);
if(msg->hdr.times_downloaded)
fprintf(fp,"%-20.20s %lu\n" ,"times_downloaded" ,msg->hdr.times_downloaded);
if(msg->hdr.last_downloaded)
fprintf(fp,"%-20.20s %.24s\n" ,"last_downloaded" ,ctime((time_t*)&msg->hdr.last_downloaded));
if(msg->hdr.last_downloaded) {
tt=msg->hdr.last_downloaded;
fprintf(fp,"%-20.20s %.24s\n" ,"last_downloaded" ,ctime(&tt));
}
fprintf(fp,"%-20.20s %06lXh\n" ,"header offset" ,msg->idx.offset);
fprintf(fp,"%-20.20s %u\n" ,"header length" ,msg->hdr.length);
......
......@@ -768,7 +768,7 @@ static void set_convenience_ptr(smbmsg_t* msg, ushort hfield_type, void* hfield_
msg->summary=(char*)hfield_dat;
break;
case SMB_EXPIRATION:
msg->expiration=*(time_t*)hfield_dat;
msg->expiration=*(uint32_t*)hfield_dat;
break;
case SMB_PRIORITY:
msg->priority=*(uint32_t*)hfield_dat;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment