[nos-bbs] getting mail into the BBS
Torsten Harenberg
harenberg at physik.uni-wuppertal.de
Sat Mar 18 06:59:22 EST 2006
Dear Tim,
thanks for your reply.
I debugged a bit more now and the actual problem is here (see
index.c:446 inside WriteIndex() ):
/* write date */
write(idx,&ind->date,sizeof(ind->date));
xlen += sizeof(ind->date);
/* write all Cc addressees */
for(cc=ind->cclist;cc;cc=cc->next){
write(idx,cc->to,strlen(cc->to)+1);
xlen += strlen(cc->to)+1;
}
write(idx,&null,sizeof(null));
xlen += sizeof(null);
/* write all forwarded bbs's */
for(bbs=ind->bbslist;bbs;bbs = bbs->next){
write(idx,bbs->call,strlen(bbs->call)+1);
xlen += strlen(bbs->call)+1;
}
/* terminate with null character */
write(idx,&null,sizeof(null));
xlen += sizeof(null);
/* Now update the length */
len = (int) (lseek(idx,0,SEEK_CUR) - startoffset - sizeof(len));
lseek(idx,startoffset,SEEK_SET); /* regain start pos */
if (len != xlen) { /* serious write or seek error */
write(idx, &null, 0); /* truncate index */
return -1;
}
The last comparison (len != xlen) is true (len is -5 (!) and xlen is 79)
resulting in the error code. I haven't yet understood what this code
really does (just traced the problem down this very minute). Maybe it is
again a CR/LF problem? Anybody has a deeper knowledge of the code?
Best regards,
Torsten DL1THM
Tim Gorman wrote:
> Did you make root part of the wheel group in your /etc/groups file?
>
> Do an su to root, cd to your jnos/spool/mail directory, do a "vi test", enter
> some gibberish and then try to save. See if you get a file permission error.
>
> tim ab0wr
>
> On Wednesday 15 March 2006 15:28, Torsten Harenberg wrote:
>> Hi Tim,
>>
>> well.. I have no close look into the code, so I'm not 100% sure, but as
>> far as I understood, the message come from here (main.c:2503)
>>
>> if(IndexFile(argv[i],0) != 0)
>> tprintf("Error writing index file for %s\n",argv[i]);
>> /* Remove the lock */
>> rmlock(Mailspool,argv[i]);
>>
>> So this message will be printed when IndexFile calls a return with
>> something else than 0.
>>
>> int IndexFile(char *name,int verbose) is in index.c and has seven
>> return's which give non-zero error codes.
>>
>> So I put some debug tprintf statements into that function and those told
>> me that code snipplet down in my mail is the one doing the return != 0.
>>
>> So before going further down in the code and find the atomic statement
>> causing the problem, I was hoping that somebody with more experience may
>> know what goes wrong.
>>
>> File permissions is a good hint. I put everything on root:wheel 744
>> (jnos is running as root). I haven't found any documentation telling me
>> that this is wrong (actually I haven't found anything about file
>> permissions, yet).
>>
>> Any thoughts on that?
>>
>> Best regards,
>>
>> Torsten
>>
>> Tim Gorman wrote:
>>> Are you sure you have the right code location? Your error message says it
>>> is having a problem writing the index file. The code you reference has to
>>> do with reading a file.
>>>
>>> bgets() just calls fgets() and then cycles through the string replacing
>>> all 0xd and 0xa instances with \0.
>>>
>>> I am assuming that a write function is called somewhere and that is what
>>> is actually causing the failure to write. Could this be a permission
>>> problem?
>>>
>>> tim ab0wr
>>>
>>> On Wednesday 15 March 2006 03:53, Torsten Harenberg wrote:
>>>> Dear all,
>>>>
>>>> I investigated this a bit further and I know now that the index files
>>>> cannot be rewritten:
>>>>
>>>> jnos> index dl1thm
>>>> Error writing index file for dl1thm
>>>>
>>>> jnos>
>>>>
>>>>
>>>> I crawled a bit through the code and found, that I get a error code in
>>>> index.c exactly here:
>>>>
>>>> /* Read the 'Received...' and 'ID... lines'
>>>> * to get the msgid - WG7J
>>>> */
>>>> if(bgets(buf, sizeof(buf), fp) == NULL) { /* "Received "
>>>> line */
>>>> default_index("",&ind);
>>>> fclose(fp);
>>>> close(idx);
>>>> return ERROR;
>>>> }
>>>>
>>>>
>>>> Files look like this:
>>>>
>>>> apfel:~/jnos/spool/mail root# hexdump dl1thm.ind
>>>> 0000000 0000 0001 0000 0000 0000 0000
>>>> 000000c
>>>> apfel:~/jnos/spool/mail root# cat dl1thm.usr
>>>> dl1thm 0
>>>> apfel:~/jnos/spool/mail root# cat dl1thm.ind
>>>> apfel:~/jnos/spool/mail root# cat dl1thm.txt
>>>> From dl1thm at dl1thm.ampr.org Wed Mar 15 10:44:05 2006
>>>> Received: from dl1thm.ampr.org by dl1thm.ampr.org (JNOS2.0d) with SMTP
>>>> id AA35 ; Wed, 15 Mar 2006 10:44:05 CET
>>>> Date: Wed, 15 Mar 2006 10:43:57 CET
>>>> Message-Id: <33 at dl1thm.ampr.org>
>>>> From: dl1thm at dl1thm.ampr.org
>>>> To: dl1thm
>>>> Subject: testmail
>>>> X-BBS-Msg-Type: P
>>>> X-JNOS-User-Port: Telnet (dl1thm @ 127.0.0.1) -> Sending message
>>>>
>>>> Testmail
>>>>
>>>> From dl1thm at dl1thm.ampr.org Wed Mar 15 10:44:18 2006
>>>> Received: from dl1thm.ampr.org by dl1thm.ampr.org (JNOS2.0d) with SMTP
>>>> id AA38 ; Wed, 15 Mar 2006 10:44:18 CET
>>>> Date: Wed, 15 Mar 2006 10:44:09 CET
>>>> Message-Id: <36 at dl1thm.ampr.org>
>>>> From: dl1thm at dl1thm.ampr.org
>>>> To: dl1thm at dl1thm
>>>> Subject: testmail2
>>>> X-BBS-Msg-Type: P
>>>> X-JNOS-User-Port: Telnet (dl1thm @ 127.0.0.1) -> Sending message
>>>>
>>>> testmail2
>>>>
>>>>
>>>>
>>>> Any ideas?
>>>>
>>>> Thanks and best regards,
>>>>
>>>> Torsten DL1THM
--
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
<> <>
<> Torsten Harenberg harenberg at physik.uni-wuppertal.de <>
<> Bergische Universitaet <>
<> FB C - Physik Tel.: +49 (0)202 439-3521 <>
<> Gaussstr. 20 Fax : +49 (0)202 439-2811 <>
<> 42097 Wuppertal <>
<> <>
<><><><><><><>< Of course it runs NetBSD http://www.netbsd.org ><>
More information about the nos-bbs
mailing list