BusyBox Bug and Patch Tracking
BusyBox
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000576 [BusyBox] Networking Support minor always 12-02-05 07:55 12-15-05 23:40
Reporter farnerup View Status public  
Assigned To BusyBox
Priority normal Resolution no change required  
Status closed   Product Version 1.01
Summary 0000576: inetd does not set argv[0]
Description When inetd (1.01) calls a service handler it doesn't set argv[0], which obviously makes e.g. busybox telnetd fail to work. Attaching a patch.
Additional Information
Attached Files  inetd-argv0.patch [^] (424 bytes) 12-02-05 07:56

- Relationships

- Notes
(0000722)
vodz
12-05-05 08:19

No. Its special for wrappers and documented:

     The server program arguments should be just as arguments normally are,
     starting with argv[0], which is the name of the program.

See manuals for BSD inetd(8)
 
Please close this bugreport.
 
(0000723)
farnerup
12-05-05 08:37

Well, yes, they should be, but the point is they aren't.
argv[0] is NULL.
 
(0000725)
vodz
12-05-05 10:07

> Well, yes, they should be, but the point is they aren't. argv[0] is NULL.

A trivail test from busybox tree:
$ echo "
2121 stream tcp nowait `id -un` `pwd`/busybox ls
" > inetd_test.conf

$ ./busybox inetd inetd_test.conf

$ telnet localhost 2121
bin
etc
...

Its work.
 
(0000726)
vodz
12-05-05 10:11

> Well, yes, they should be, but the point is they aren't. argv[0] is NULL.

A trivail test from busybox tree:
$ echo "
2121 stream tcp nowait `id -un` `pwd`/busybox ls
" > inetd_test.conf

$ ./busybox inetd inetd_test.conf

$ telnet localhost 2121
bin
etc
...

Its work.
 
(0000727)
farnerup
12-06-05 01:19

As I said, I am using busybox-1.01. The relevant code has changed in busybox-1.1.0-pre1 and it is possible that the problem has been fixed. However, in busybox-1.01/networking/inetd.c in the function getconfigent():

    cp_ptr = strtok_r(NULL, " \t", &cp_ptr_ptr);

    // snip

    sep->se_server = inetd_strdup(cp_ptr);

    argc = 0;
    while ((cp_ptr = strtok_r(NULL, " \t", &cp_ptr_ptr)) != NULL) {
        if (argc < MAXARGV) {
            sep->se_argv[argc++] = inetd_strdup(cp_ptr);
        }
    }

Obviously, argv[0] is set to the first argument (if it exists), which would normally be argv[1].
 
(0000728)
vodz
12-06-05 02:13

> Obviously, argv[0] is set to the first argument (if it exists), which would
> normally be argv[1].

I don`t see problem in this code.
First argument used in exec(full_path_cmd, ...)
Second argument is argv[0] for exec(full_path_cmd, argv, NULL) and MUST EXIST.
I again have recomended read manuals for BSD inetd(8).
 
(0000729)
farnerup
12-06-05 02:33

Ok, I get it. I'm sorry.
 

- Issue History
Date Modified Username Field Change
12-02-05 07:55 farnerup New Issue
12-02-05 07:56 farnerup Status new => assigned
12-02-05 07:56 farnerup Assigned To  => BusyBox
12-02-05 07:56 farnerup File Added: inetd-argv0.patch
12-05-05 08:19 vodz Note Added: 0000722
12-05-05 08:37 farnerup Note Added: 0000723
12-05-05 10:08 vodz Note Added: 0000725
12-05-05 10:11 vodz Note Added: 0000726
12-06-05 01:19 farnerup Note Added: 0000727
12-06-05 02:13 vodz Note Added: 0000728
12-06-05 02:33 farnerup Note Added: 0000729
12-15-05 23:40 landley Status assigned => closed
12-15-05 23:40 landley Resolution open => no change required


Copyright © 2000 - 2006 Mantis Group
Powered by Mantis Bugtracker