Bug 8077

Summary: wvdial incorrectly builds pppd'd argv
Product: [Retired] Red Hat Linux Reporter: Christian Hechelmann <drdisk>
Component: wvdialAssignee: Nalin Dahyabhai <nalin>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-01-18 15:36:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Christian Hechelmann 1999-12-31 00:53:05 UTC
wvdial does not correctly build the argv array to exec pppd. Depending on
the configuration of the dialer section to be called the argv array
contains NULL argument pointers followed by non NULL arguemnt pointers
(specifically an unset remote_name causes this bug to show). This argv
is passed unchanged to execvp(). Since exec*() stops on the first NULL in
the argument array the arguments follwing the first NULL are never passed
to pppd (which means ppp never sees "call wvdial" and all (new) connections
fail (at least in my case)).

This Problem applies to rp3 also since it uses the same code from wvdial.

Patch file will be attached to this bug report.

Comment 1 Christian Hechelmann 1999-12-31 01:15:59 UTC
Since createattachment.cgi always fails with "no file provided or file emtpy"
here we go:

--- wvdial-1.40/wvdial/wvdialer.cc.braindamage  Fri Dec 31 00:36:37 1999
+++ wvdial-1.40/wvdial/wvdialer.cc      Fri Dec 31 00:51:53 1999
@@ -595,6 +595,7 @@
 /************************/
 {
     WvString   addr_colon( "%s:", options.force_addr );
+    int i;

     char const *argv[] = {
        options.where_pppd,
@@ -605,12 +606,28 @@
        "-detach",
        "user", options.login,
        options.force_addr[0] ? (const char *)addr_colon : "noipdefault",
-       remote_name ? "remotename" : NULL,
-       remote_name ? remote_name : NULL,
-       options.new_pppd ? "call" : NULL,
-       options.new_pppd ? "wvdial" : NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
        NULL
     };
+
+    /* XXX FIXME: This is a gross hack but works */
+    /*            The older method did _not_ work since exec*() argv */
+    /*            parsing stops on the first NULL, so pppd never gets */
+    /*            "call wvdial" as arguemnts when no remote_name is */
+    /*            provided. Someone speaking C++ should have a look at this */
+    i = 8;
+    if(remote_name) {
+      argv[i++] = "remotename";
+      argv[i++] = remote_name;
+    }
+
+    if(options.new_pppd) {
+      argv[i++] = "call";
+      argv[i++] = "wvdial";
+    }

     if( !chat_mode && (access( options.where_pppd, X_OK ) != 0) ) {
         err( "Unable to run %s.\n", options.where_pppd );

Comment 2 Nalin Dahyabhai 2000-01-18 15:36:59 UTC
This should be fixed in wvdial-1.41-1, which is now in Raw Hide.