Blame SOURCES/wvdial-1.60-remotename.patch

4a45da
#allow specifying the remotename at startup-time
4a45da
#In Fedora since Aug 2002, Fedora specific
4a45da
4a45da
diff -up wvdial-1.60/wvdialer.h.remotename wvdial-1.60/wvdialer.h
4a45da
--- wvdial-1.60/wvdialer.h.remotename	2007-07-19 17:22:26.000000000 -0400
4a45da
+++ wvdial-1.60/wvdialer.h	2007-10-29 12:53:46.000000000 -0400
4a45da
@@ -43,7 +43,8 @@ class WvDialer : public WvStreamClone
4a45da
 /***********************************/
4a45da
 {
4a45da
 public:
4a45da
-    WvDialer( WvConf &_cfg, WvStringList *_sect_list, bool _chat_mode = false );
4a45da
+    WvDialer( WvConf &_cfg, WvStringList *_sect_list, bool _chat_mode = false,
4a45da
+	      WvString _remote_name = NULL );
4a45da
     virtual ~WvDialer();
4a45da
    
4a45da
     bool	dial();
4a45da
diff -up wvdial-1.60/wvdial.cc.remotename wvdial-1.60/wvdial.cc
4a45da
--- wvdial-1.60/wvdial.cc.remotename	2007-07-19 17:22:26.000000000 -0400
4a45da
+++ wvdial-1.60/wvdial.cc	2007-10-29 12:56:54.000000000 -0400
4a45da
@@ -93,6 +92,7 @@ int main(int argc, char **argv)
4a45da
     WvStringList	cmdlineopts;
4a45da
     WvLog		log( "WvDial", WvLog::Debug );
4a45da
     WvString		homedir = getenv("HOME");
4a45da
+    WvString		remote_name = NULL;
4a45da
     
4a45da
     bool chat_mode = false;
4a45da
     bool write_syslog = true;
4a45da
@@ -122,6 +122,9 @@ int main(int argc, char **argv)
4a45da
     args.add_option('C', "config",
4a45da
 		    "use configfile instead of /etc/wvdial.conf",
4a45da
 		    "configfile", WvArgs::ArgCallback(&config_cb), &cfg;;
4a45da
+    args.add_option('\0', "remotename",
4a45da
+		    "Override Remote Name setting from config file",
4a45da
+		    "remote name", remote_name);
4a45da
     args.add_set_bool_option('c', "chat",
4a45da
 			     "used when running wvdial from pppd", chat_mode);
4a45da
     args.add_reset_bool_option('n', "no-syslog",
4a45da
@@ -209,7 +212,7 @@ int main(int argc, char **argv)
4a45da
 	} 
4a45da
     }
4a45da
     
4a45da
-    WvDialer dialer(cfg, &sections, chat_mode);
4a45da
+    WvDialer dialer(cfg, &sections, chat_mode, remote_name);
4a45da
     
4a45da
     if (!chat_mode)
4a45da
 	if (dialer.isok() && dialer.options.ask_password)
4a45da
diff -up wvdial-1.60/wvdial.1.remotename wvdial-1.60/wvdial.1
4a45da
--- wvdial-1.60/wvdial.1.remotename	2007-07-19 17:22:26.000000000 -0400
4a45da
+++ wvdial-1.60/wvdial.1	2007-10-29 12:01:59.000000000 -0400
4a45da
@@ -68,6 +68,12 @@ This is mainly useful only if you want t
4a45da
 configurations, or you want to avoid having dial-up information (usernames,
4a45da
 passwords, calling card numbers, etc.) in a system wide configuration file.
4a45da
 .TP
4a45da
+.B \-\-remotename
4a45da
+Override the Remote Name setting in the dialer configuration section of the
4a45da
+configuration file. This is mainly useful when you dial to multiple systems
4a45da
+with the same user name and password, and you don't want to use inheritance
4a45da
+to override this setting (which is the recommended way to do it).
4a45da
+.TP
4a45da
 .B \-n, \-\-no\-syslog
4a45da
 Don't output debug information to the syslog daemon (only useful together
4a45da
 with \-\-chat).
4a45da
diff -up wvdial-1.60/wvdialer.cc.remotename wvdial-1.60/wvdialer.cc
4a45da
--- wvdial-1.60/wvdialer.cc.remotename	2007-07-19 17:22:26.000000000 -0400
4a45da
+++ wvdial-1.60/wvdialer.cc	2007-10-29 12:54:09.000000000 -0400
4a45da
@@ -55,7 +55,8 @@ static int messagetail_pid = 0;
4a45da
 //       WvDialer Public Functions
4a45da
 //**************************************************
4a45da
 
4a45da
-WvDialer::WvDialer( WvConf &_cfg, WvStringList *_sect_list, bool _chat_mode )
4a45da
+WvDialer::WvDialer( WvConf &_cfg, WvStringList *_sect_list, bool _chat_mode,
4a45da
+                    WvString _remote_name )
4a45da
 /***************************************************************************/
4a45da
 : WvStreamClone( 0 ),
4a45da
     cfg(_cfg), log( "WvDial", WvLog::Debug ),
4a45da
@@ -125,6 +126,12 @@ WvDialer::WvDialer( WvConf &_cfg, WvStri
4a45da
 	return;
4a45da
     }
4a45da
     
4a45da
+    // Override configuration settings with any we got from the command-line.
4a45da
+    if( _remote_name != NULL ) {
4a45da
+        options.remote = _remote_name;
4a45da
+        options.remote.unique();
4a45da
+    }
4a45da
+
4a45da
     if (options.provider.len()) 
4a45da
     {
4a45da
 	log( WvLog::Notice, "Dialing %s %s.\n",
4a45da
@@ -1220,6 +1227,8 @@ void WvDialer::start_ppp()
4a45da
 	options.new_pppd && options.idle_seconds >= 0 ? (const char *)idle_seconds : NULL, 
4a45da
 	"logfd", buffer1,
4a45da
 //	!!buffer2 ? "passwordfd" : NULL, !!buffer2 ? (const char *)buffer2 : NULL,
4a45da
+	options.remote.len() ? "remotename"   : NULL,
4a45da
+	options.remote.len() ? (const char *) options.remote : NULL,
4a45da
 	NULL
4a45da
     };
4a45da