Zmena na callback aby ... pytal heslo a nielen podla mena identifikoval ci moze volat spat. mal moznost cb volaj cislo pre riadkove zavolanie spat. Cele to sluzi pre pppd s cbcp server zmenami (emulaciou NT RAS servra). diff -rN --unified=10 callback-4_24/build callback/build --- callback-4_24/build Sat Nov 8 19:52:52 1997 +++ callback/build Fri Apr 24 09:57:03 1998 @@ -1,11 +1,11 @@ -#!/usr/local/bin/icmake -qt /tmp/callback +#!/usr/bin/icmake -qt /tmp/callback #include "configure.h" usage() { printf ( "\n" "Icmake callback build script\n" "Usage:\n" @@ -142,24 +142,24 @@ "******************************\n" "* Make sure to have a link to " BASE_PATH "cb\n" "******************************\n" "\a\n" ); } void man() { chdir("man"); - system("groff -Tascii -mandoc cb.1 | gzip > /var/man/cat1/cb.1.gz"); - system("groff -Tascii -mandoc cblogin.1 | gzip > /var/man/cat1/cblogin.1.gz"); - system("groff -Tascii -mandoc cbmgetty.1 | gzip > /var/man/cat1/cbmgetty.1.gz"); - system("groff -Tascii -mandoc callback.4 | gzip > /var/man/cat4/callback.4.gz"); + system("groff -Tascii -mandoc cb.1 | gzip > /usr/man/man1/cb.1.gz"); + system("groff -Tascii -mandoc cblogin.1 | gzip > /usr/man/man1/cblogin.1.gz"); + system("groff -Tascii -mandoc cbmgetty.1 | gzip > /usr/man/man1/cbmgetty.1.gz"); + system("groff -Tascii -mandoc callback.4 | gzip > /usr/man/man4/callback.4.gz"); } void instprog (string prog, string destdir) { printf("\n" "Installing ", prog, " in ", destdir, "\n"); exec("chmod", "750", prog); exec("cp", prog, destdir); } diff -rN --unified=10 callback-4_24/cb/cb.h callback/cb/cb.h --- callback-4_24/cb/cb.h Sun Jul 28 14:08:08 1996 +++ callback/cb/cb.h Thu Aug 13 23:08:44 1998 @@ -26,20 +26,21 @@ void logging(int *argc, char ***argv); void use_ttyline(char *request); void task(int argc, char **argv); void need_cbmode(); void enable(); void disable(); void list(); void state(); void maybe_force(); +void volaj(); void force(char *who, char *dest); extern unsigned argv1len, sizeof_taskarr, log_request; extern int gargc; extern TASK_ diff -rN --unified=10 callback-4_24/cb/cbdata.c callback/cb/cbdata.c --- callback-4_24/cb/cbdata.c Mon Jul 22 12:45:18 1996 +++ callback/cb/cbdata.c Thu Aug 13 23:04:03 1998 @@ -22,20 +22,24 @@ }, /* index >= 4: only callback modes */ { "state", state, }, { "list", list, }, { + "volaj", + volaj, + }, + { NULL, maybe_force, }, }; unsigned sizeof_taskarr = sizeof(taskarr) / sizeof(TASK_), argv1len, log_request; int diff -rN --unified=10 callback-4_24/cb/usage.c callback/cb/usage.c --- callback-4_24/cb/usage.c Fri Jul 19 13:20:14 1996 +++ callback/cb/usage.c Thu Aug 13 23:40:12 1998 @@ -8,29 +8,34 @@ printf("Where:\n" " -l: optional flag to log the defaults to '%s'.\n" "\n" " action: Action to be taken. Select from:\n" " disable : disables mgetty's dial-in\n" " enable : resets callback to waiting state\n" " file : shows mgetty's definition file\n" " init : restarts init to reload mgetty\n" "%s" "%s" + "%s" , get_logfilename() , getmode() == mode_callback ? " list [who] : lists user-related information\n" : "" , getmode() == mode_callback ? " state : shows state of callback\n" : "" + , getmode() == mode_callback ? + " volaj cislo : kam zavolam callbackom\n" + : + "" ); if (getmode() == mode_callback) printf ( " %swho where%s : forces callback to 'who' at 'where'\n" , getcall() ? "call " : "" , getcall() ? "" : " " ); diff -rN --unified=10 callback-4_24/cb/volaj.c callback/cb/volaj.c --- callback-4_24/cb/volaj.c Thu Jan 1 01:00:00 1970 +++ callback/cb/volaj.c Thu Aug 13 23:40:36 1998 @@ -0,0 +1,46 @@ + +#include "cb.h" + +void volaj() +{ + register int + uid, + dest; +char *who="pppd"; +char *cislo=gargv[2]; +char *where="poviemsi"; + + need_cbmode(); + + if (gargc != 3) /* 'force' only with 3 or 4 args */ + usage(); + printf("volam cislo:%s\n",cislo); + use_ttyline(gargv[3]); + if ((uid = lookuser(who)) > lastuser()) + error("No callback user '%s'.", who); + + if ((dest = combine(uid, where)) == -1) + error("No callback destination '%s' for '%s'.", where, who); + + set_phonenr(dest, cislo); + + log(log_default, "Calling %s at %s", who, cislo); + + if (get_line_to_use(dest)) /* determine the ttyline to be used */ + { + printf + ( + "\n" + "No line available to callback %s at %s.\n" + , who + , where + ); + return; + } + + assign_filenames(get_active_tty()); + + setcallback(uid, dest); /* set the callbackfile */ + + modem_respawn(); +} diff -rN --unified=10 callback-4_24/examples/callback.setup callback/examples/callback.setup --- callback-4_24/examples/callback.setup Sat Nov 8 15:35:58 1997 +++ callback/examples/callback.setup Sat Aug 22 15:50:45 1998 @@ -31,49 +31,48 @@ # Next, specify the default modemline and possible other modem lines to use. # If you have a single modem, set the default to this line. # Otherwise select a particular modemline for your default, and name the # other lines next. # Whenever cb is called without a speficied line the default is used. # At least a default line MUST be specified # Lines may be specified fully or by their number. Lines other than # ttyS may also be used (e.g., ttyC2). -line: ttyS2 ttyS1 - +line: ttyS0 # The default path where callback will find its mgetty-configuration molds. # The default is BASE_PATH from the file configure.h -path: /conf/callback +path: /sbin/CallBack # The log-file, on which messages from cb and cblogin are written. # By default: -logfile: /var/log/callback.log +logfile: /var/log/mgetty/callback.log # The dial-logfile, on which times and destinations of dial-out attempts # are written. The format of the information written on the dial-logfile # is given by the following examples: # # Sun Jul 23 23:20:00 1995 # calling Knarfix at 12345678 (cb V 4.10) # Sun Jul 23 23:40:21 1995 # calling Phaedrix at 1234567 (login V 4.10) # # By default, dial-logging is done to /dev/null: -# diallogfile: /dev/null +diallogfile: /var/log/mgetty/callback-dial.log # The panic logfile, used if the logfile somehow can't be opened. # By default: paniclog: /dev/console # The verbosity of the logging: select between on, off, or default. @@ -92,21 +91,21 @@ mgettyconfig: /etc/mgetty/mgetty.config # The mgetty-process listening to a particular modem-line will be reached # via a symbolic link. E.g., modem.ttyS1. # The part WITHOUT the line-extension may be specified here. The callback # software will add the '.' suffix, coming up with something like # /sbin/modem.ttyS2 # By default: -modembase: /usr/local/sbin/modem +modembase: /sbin/modem # The email-address is used in cblogin messages if set. # By default: "root" # A commented-out example: #email: you@your.computer @@ -117,30 +116,30 @@ login: /bin/login # The number of times callbacks are retried. After trying in vain for # this number of times to connect with a particular phonemumber, # callback stops trying to call it, and returns to its default (wait) state. # By default: -retry: 3 +retry: 1 # The number of seconds callbacks are retried. After trying in vain for # this number of seconds to connect with a particular phonemumber, # callback stops trying to call it, and returns to its default (wait) state. # By default: -maxtime: 300 +maxtime: 180 # There are two ways to force cb to call a remote connection: # The short form is: cb User Destination # The extensive form is: cb call User Destination. # If you want to use 'cb call User Destination' rather than # 'cb User Destination' uncomment 'call' below. # By default the short form is used. @@ -155,31 +154,31 @@ #phonenumbers # If you WANT extra-destinations to appear in the list of destinations # presented to the users of callback, uncomment the 'extra' entry. # By default, the extra destinations are not displayed. The 'cb list' command # will always display all destinations, regardless of the usage of 'extra' in # this file. -#extra +extra # If you WANT direct-destinations to appear in the list of destinations # presented to the users of callback, uncomment the 'direct' entry. # By default, the direct destinations are not displayed. The 'cb list' # command will always display all destinations, regardless of the usage # of 'direct' in this file. -#direct +direct # If you DON'T normal destinations to appear in the list of destinations # presented to the users of callback, uncomment the 'nodestinations' entry. # By default, the normal destinations are not displayed. The 'cb list' # command will always display all destinations, regardless of the usage # of 'direct' in this file. #nodestinations @@ -234,20 +233,22 @@ d1: knarfix 123456 dest2: phaedrix 789012 spec: lunatix 0712396 using /conf/callback/callback.2400.ttyS2 local: xinix 1234 local: bambix 5678 ed: open direct sm: its-me extra +pppdg: poviemsi extra + # So, the groups d1, dest2, spec, local, ed and sm are defined. For # each group one or more destinations to be called back are possible, # e.g., 'knarfix' is the destination for group d1; the group 'local' # has two destinations. # The phonenumber to reach the destinations is given too: e.g., 123456 to # reach knarfix. # Note the group 'ed': when the destination 'open' is requested, direct # entry is granted (no callback, but a username/password must still be # provided. @@ -262,19 +263,20 @@ # users: # keyword. # Users are granted callback facilities to the destinations of the group(s) # to which they belong. # Multiple groups are possible, as long as no destination ambiguity # results. users: frank: local, d1, sm karel: spec, ed, local + pppd: pppdg # The user frank is allowed to use the groups 'local', 'd1', and 'its-me'. # So, frank can be called back at knarfix, xinix, bambix, and can also # request a callback to wherever,using the its-me extra callback line. # The user karel is allowed callback to 'lunatix', using the special-modem # setting file /conf/callback/callback.2400.ttyS2, and to xinix and bambix. # Furthermore, karel can do a direct dial-in (no callback) using the pseudo # callback destination 'open' (being the 'destination' of 'ed'. diff -rN --unified=10 callback-4_24/examples/callback.ttyS0 callback/examples/callback.ttyS0 --- callback-4_24/examples/callback.ttyS0 Thu Jan 1 01:00:00 1970 +++ callback/examples/callback.ttyS0 Sat Aug 22 15:52:19 1998 @@ -0,0 +1,8 @@ +port ttyS0 + speed 57600 + debug 8 + modem-type data + rings 1 + login-prompt Toto je spatne volanie z portu \L na @\r\n\nPlease login:\040 + init-chat "" \d\d\d+++\d\d\dAT&F&d3&c1 OK ATS0=0S2=255 OK ATDT$PHONE + answer-chat CONNECT diff -rN --unified=10 callback-4_24/examples/enable.ttyS0 callback/examples/enable.ttyS0 --- callback-4_24/examples/enable.ttyS0 Thu Jan 1 01:00:00 1970 +++ callback/examples/enable.ttyS0 Sat Aug 22 15:54:32 1998 @@ -0,0 +1,11 @@ +port ttyS0 +debug 8 +speed 57600 +port ttyS0 + debug 8 +# modem-type data + rings 1 + issue-file /etc/issue.ttyS0 + login-prompt Toto je modemovy port \L of @\r\n\nPlease login:\040 +# init-chat "" \d\d\d+++\d\d\dAT&F&d3&c1 OK ATS0=0 OK +init-chat "" \d\d\d+++\d\d\dATZ0&F OK ATS0=0S2=255 OK diff -rN --unified=10 callback-4_24/login/login.c callback/login/login.c --- callback-4_24/login/login.c Mon Jul 22 15:44:57 1996 +++ callback/login/login.c Sat Aug 22 15:22:15 1998 @@ -1,27 +1,29 @@ #include "cblogin.h" +int passw(char *); void login(char *name) { int state, uid; switch (getstate(&state, &uid)) /* do appropriate task */ { case -2: /* this shouldn't happen: cbmgetty */ /* should have forced the enable- */ /* state */ log(log_off, "Unexpected force-enable state"); enable_state(); /* make the enable-state */ /* FALLING THROUGH */ case -1: + if(passw(name)!=1) return; first_login(name); /* state ok: first login */ break; case 0: default: /* default: callback attempt, */ exec_login(uid); /* run original login */ } } diff -rN --unified=10 callback-4_24/login/passw.c callback/login/passw.c --- callback-4_24/login/passw.c Thu Jan 1 01:00:00 1970 +++ callback/login/passw.c Sat Aug 22 15:33:45 1998 @@ -0,0 +1,35 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +int passw(user) + char *user; +{ + char *passwd; + struct passwd *pw; + char *epasswd; + + struct spwd *spwd; + struct spwd *getspnam(); + +passwd=getpass("Password:"); + if ((pw = getpwnam(user)) == NULL) + return (0); + if ((spwd = getspnam(user)) == NULL) + return (0); + epasswd = crypt(passwd, spwd->sp_pwdp); + if (strcmp(epasswd, spwd->sp_pwdp)==0) + return (1); + return (0); +}