FreeBSD Bugzilla – Attachment 203 Details for
Bug 1021
pppd doesn't handle PAP-only authentication well
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 4.34 KB, created by
David Muir Sharnoff
on 1996-02-12 10:40:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
David Muir Sharnoff
Created:
1996-02-12 10:40:01 UTC
Size:
4.34 KB
patch
obsolete
>diff -r -c pppd/auth.c idiompppd/auth.c >*** pppd/auth.c Sat Sep 2 07:52:54 1995 >--- idiompppd/auth.c Mon Feb 12 01:14:30 1996 >*************** >*** 360,365 **** >--- 360,369 ---- > char passwd[256], user[256]; > char secret[MAXWORDLEN]; > static int attempts = 0; >+ struct stat s_loginopts; >+ int code; >+ char cmd[1024]; >+ extern int baud_rate; > > /* > * Make copies of apasswd and auser, then null-terminate them. >*************** >*** 399,404 **** >--- 403,430 ---- > if (ret == UPAP_AUTHNAK) { > syslog(LOG_WARNING, "upap login failure for %s", user); > } >+ >+ code = stat(_PATH_IPOPT, &s_loginopts); >+ >+ if (ret == UPAP_AUTHACK && code == 0) { >+ >+ sprintf(cmd, "%s %s %s %d '%s' %d", _PATH_IPOPT, ifname, devname, baud_rate, user, strlen(passwd) != 0); >+ f = popen(cmd, "r"); >+ if (f == NULL) { >+ syslog(LOG_ERR, "popen %s: %m", cmd); >+ ret = UPAP_AUTHNAK; >+ } else { >+ read_options_stream(f, cmd); >+ code = pclose(f); >+ if (code == -1) { >+ syslog(LOG_ERR, "pclose %s: %m", cmd); >+ ret = UPAP_AUTHNAK; >+ } else if (code != 0) { >+ syslog(LOG_WARNING, "%s %s returned %d - access denied", _PATH_IPOPT, user, code); >+ ret = UPAP_AUTHNAK; >+ } >+ } >+ } > } > > if (ret == UPAP_AUTHNAK) { >*************** >*** 459,488 **** > if (pw->pw_expire && time(NULL) >= pw->pw_expire) > return (UPAP_AUTHNAK); > >- /* >- * XXX If no passwd, let them login without one. >- */ >- if (pw->pw_passwd == '\0') { >- return (UPAP_AUTHACK); >- } >- > epasswd = crypt(passwd, pw->pw_passwd); > if (strcmp(epasswd, pw->pw_passwd)) { > return (UPAP_AUTHNAK); > } > > syslog(LOG_INFO, "user %s logged in", user); >- >- /* >- * Write a wtmp entry for this user. >- */ >- tty = strrchr(devname, '/'); >- if (tty == NULL) >- tty = devname; >- else >- tty++; >- logwtmp(tty, user, ""); /* Add wtmp login entry */ >- logged_in = TRUE; > > return (UPAP_AUTHACK); > } >--- 485,496 ---- >diff -r -c pppd/options.c idiompppd/options.c >*** pppd/options.c Fri Oct 6 08:10:14 1995 >--- idiompppd/options.c Mon Feb 12 00:06:24 1996 >*************** >*** 319,328 **** > progname); > } > >- /* >- * options_from_file - Read a string of options from a file, >- * and interpret them. >- */ > int > options_from_file(filename, must_exist, check_prot) > char *filename; >--- 319,324 ---- >*************** >*** 330,340 **** > int check_prot; > { > FILE *f; >! int i, newline, ret; >! struct cmd *cmdp; >! char *argv[MAXARGS]; >! char args[MAXARGS][MAXWORDLEN]; >! char cmd[MAXWORDLEN]; > > if ((f = fopen(filename, "r")) == NULL) { > if (!must_exist && errno == ENOENT) >--- 326,332 ---- > int check_prot; > { > FILE *f; >! int ret; > > if ((f = fopen(filename, "r")) == NULL) { > if (!must_exist && errno == ENOENT) >*************** >*** 348,353 **** >--- 340,366 ---- > return 0; > } > >+ ret = read_options_stream(f, filename); >+ fclose(f); >+ return (ret); >+ } >+ >+ >+ /* >+ * options_from_file - Read a string of options from a file, >+ * and interpret them. >+ */ >+ int >+ read_options_stream(f, filename) >+ FILE *f; >+ char *filename; >+ { >+ int i, newline, ret; >+ struct cmd *cmdp; >+ char *argv[MAXARGS]; >+ char args[MAXARGS][MAXWORDLEN]; >+ char cmd[MAXWORDLEN]; >+ > while (getword(f, cmd, &newline, filename)) { > /* > * First see if it's a command. >*************** >*** 362,374 **** > fprintf(stderr, > "In file %s: too few parameters for command %s\n", > filename, cmd); >- fclose(f); > return 0; > } > argv[i] = args[i]; > } > if (!(*cmdp->cmd_func)(argv)) { >- fclose(f); > return 0; > } > >--- 375,385 ---- >*************** >*** 381,387 **** > && (ret = setipaddr(cmd)) == 0) { > fprintf(stderr, "In file %s: unrecognized command %s\n", > filename, cmd); >- fclose(f); > return 0; > } > if (ret < 0) /* error */ >--- 392,397 ---- >diff -r -c pppd/pathnames.h idiompppd/pathnames.h >*** pppd/pathnames.h Sat Sep 24 19:32:10 1994 >--- idiompppd/pathnames.h Sun Feb 11 23:59:45 1996 >*************** >*** 16,19 **** >--- 16,20 ---- > #define _PATH_IPUP "/etc/ppp/ip-up" > #define _PATH_IPDOWN "/etc/ppp/ip-down" > #define _PATH_TTYOPT "/etc/ppp/options." >+ #define _PATH_IPOPT "/etc/ppp/ip-login" > #define _PATH_USEROPT ".ppprc"
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1021
: 203