Deleted Added
full compact
auth.c (31343) auth.c (31962)
1/*
2 * PPP Secret Key Module
3 *
4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
5 *
6 * Copyright (C) 1994, Internet Initiative Japan, Inc. All rights reserverd.
7 *
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the Internet Initiative Japan, Inc. The name of the
14 * IIJ may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 *
1/*
2 * PPP Secret Key Module
3 *
4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
5 *
6 * Copyright (C) 1994, Internet Initiative Japan, Inc. All rights reserverd.
7 *
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the Internet Initiative Japan, Inc. The name of the
14 * IIJ may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 *
20 * $Id: auth.c,v 1.23 1997/11/17 00:42:37 brian Exp $
20 * $Id: auth.c,v 1.24 1997/11/22 03:37:24 brian Exp $
21 *
22 * TODO:
23 * o Implement check against with registered IP addresses.
24 */
25#include <sys/param.h>
26#include <netinet/in.h>
27
28#include <stdio.h>

--- 45 unchanged lines hidden (view full) ---

74 char *vector[3];
75 char buff[LINE_LEN];
76 LOCAL_AUTH_VALID rc;
77
78 rc = NOT_FOUND; /* No system entry */
79 fp = OpenSecret(fname);
80 if (fp == NULL)
81 return (rc);
21 *
22 * TODO:
23 * o Implement check against with registered IP addresses.
24 */
25#include <sys/param.h>
26#include <netinet/in.h>
27
28#include <stdio.h>

--- 45 unchanged lines hidden (view full) ---

74 char *vector[3];
75 char buff[LINE_LEN];
76 LOCAL_AUTH_VALID rc;
77
78 rc = NOT_FOUND; /* No system entry */
79 fp = OpenSecret(fname);
80 if (fp == NULL)
81 return (rc);
82 while (fgets(buff, sizeof(buff), fp)) {
82 while (fgets(buff, sizeof buff, fp)) {
83 if (buff[0] == '#')
84 continue;
85 buff[strlen(buff) - 1] = 0;
83 if (buff[0] == '#')
84 continue;
85 buff[strlen(buff) - 1] = 0;
86 memset(vector, '\0', sizeof(vector));
86 memset(vector, '\0', sizeof vector);
87 n = MakeArgs(buff, vector, VECSIZE(vector));
88 if (n < 1)
89 continue;
90 if (strcmp(vector[0], system) == 0) {
91 if ((vector[1] == (char *) NULL && (key == NULL || *key == '\0')) ||
92 (vector[1] != (char *) NULL && strcmp(vector[1], key) == 0)) {
93 rc = VALID; /* Valid */
94 } else {

--- 13 unchanged lines hidden (view full) ---

108 int n;
109 char *vector[4];
110 char buff[LINE_LEN];
111 char passwd[100];
112
113 fp = OpenSecret(fname);
114 if (fp == NULL)
115 return (0);
87 n = MakeArgs(buff, vector, VECSIZE(vector));
88 if (n < 1)
89 continue;
90 if (strcmp(vector[0], system) == 0) {
91 if ((vector[1] == (char *) NULL && (key == NULL || *key == '\0')) ||
92 (vector[1] != (char *) NULL && strcmp(vector[1], key) == 0)) {
93 rc = VALID; /* Valid */
94 } else {

--- 13 unchanged lines hidden (view full) ---

108 int n;
109 char *vector[4];
110 char buff[LINE_LEN];
111 char passwd[100];
112
113 fp = OpenSecret(fname);
114 if (fp == NULL)
115 return (0);
116 while (fgets(buff, sizeof(buff), fp)) {
116 while (fgets(buff, sizeof buff, fp)) {
117 if (buff[0] == '#')
118 continue;
119 buff[strlen(buff) - 1] = 0;
117 if (buff[0] == '#')
118 continue;
119 buff[strlen(buff) - 1] = 0;
120 memset(vector, '\0', sizeof(vector));
120 memset(vector, '\0', sizeof vector);
121 n = MakeArgs(buff, vector, VECSIZE(vector));
122 if (n < 2)
123 continue;
124 if (strcmp(vector[0], system) == 0) {
121 n = MakeArgs(buff, vector, VECSIZE(vector));
122 if (n < 2)
123 continue;
124 if (strcmp(vector[0], system) == 0) {
125 ExpandString(vector[1], passwd, sizeof(passwd), 0);
125 ExpandString(vector[1], passwd, sizeof passwd, 0);
126 if (strcmp(passwd, key) == 0) {
127 CloseSecret(fp);
126 if (strcmp(passwd, key) == 0) {
127 CloseSecret(fp);
128 memset(&DefHisAddress, '\0', sizeof(DefHisAddress));
128 memset(&DefHisAddress, '\0', sizeof DefHisAddress);
129 n -= 2;
130 if (n > 0) {
131 if (ParseAddr(n--, (char const *const *)(vector+2),
132 &DefHisAddress.ipaddr,
133 &DefHisAddress.mask,
134 &DefHisAddress.width) == 0) {
135 return (0); /* Invalid */
136 }

--- 14 unchanged lines hidden (view full) ---

151 int n;
152 char *vector[4];
153 char buff[LINE_LEN];
154 static char passwd[100];
155
156 fp = OpenSecret(fname);
157 if (fp == NULL)
158 return (NULL);
129 n -= 2;
130 if (n > 0) {
131 if (ParseAddr(n--, (char const *const *)(vector+2),
132 &DefHisAddress.ipaddr,
133 &DefHisAddress.mask,
134 &DefHisAddress.width) == 0) {
135 return (0); /* Invalid */
136 }

--- 14 unchanged lines hidden (view full) ---

151 int n;
152 char *vector[4];
153 char buff[LINE_LEN];
154 static char passwd[100];
155
156 fp = OpenSecret(fname);
157 if (fp == NULL)
158 return (NULL);
159 while (fgets(buff, sizeof(buff), fp)) {
159 while (fgets(buff, sizeof buff, fp)) {
160 if (buff[0] == '#')
161 continue;
162 buff[strlen(buff) - 1] = 0;
160 if (buff[0] == '#')
161 continue;
162 buff[strlen(buff) - 1] = 0;
163 memset(vector, '\0', sizeof(vector));
163 memset(vector, '\0', sizeof vector);
164 n = MakeArgs(buff, vector, VECSIZE(vector));
165 if (n < 2)
166 continue;
167 if (strlen(vector[0]) == len && strncmp(vector[0], system, len) == 0) {
164 n = MakeArgs(buff, vector, VECSIZE(vector));
165 if (n < 2)
166 continue;
167 if (strlen(vector[0]) == len && strncmp(vector[0], system, len) == 0) {
168 ExpandString(vector[1], passwd, sizeof(passwd), 0);
168 ExpandString(vector[1], passwd, sizeof passwd, 0);
169 if (setaddr) {
169 if (setaddr) {
170 memset(&DefHisAddress, '\0', sizeof(DefHisAddress));
170 memset(&DefHisAddress, '\0', sizeof DefHisAddress);
171 }
172 n -= 2;
173 if (n > 0 && setaddr) {
174 LogPrintf(LogDEBUG, "AuthGetSecret: n = %d, %s\n", n, vector[2]);
175 if (ParseAddr(n--, (char const *const *)(vector+2),
176 &DefHisAddress.ipaddr,
177 &DefHisAddress.mask,
178 &DefHisAddress.width) != 0)

--- 45 unchanged lines hidden ---
171 }
172 n -= 2;
173 if (n > 0 && setaddr) {
174 LogPrintf(LogDEBUG, "AuthGetSecret: n = %d, %s\n", n, vector[2]);
175 if (ParseAddr(n--, (char const *const *)(vector+2),
176 &DefHisAddress.ipaddr,
177 &DefHisAddress.mask,
178 &DefHisAddress.width) != 0)

--- 45 unchanged lines hidden ---