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