mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-10 16:31:18 +01:00
Move authname and authkey into struct bundle and only allow
their alteration in PHASE_DEAD. Remove redundant pppConfs array element.
This commit is contained in:
parent
4df39d1c8f
commit
92f4ff1ccd
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/cvs2svn/branches/MP/; revision=35014
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: bundle.h,v 1.1.2.21 1998/03/25 18:38:40 brian Exp $
|
||||
* $Id: bundle.h,v 1.1.2.22 1998/04/03 19:21:07 brian Exp $
|
||||
*/
|
||||
|
||||
#define PHASE_DEAD 0 /* Link is dead */
|
||||
@ -54,6 +54,10 @@ struct bundle {
|
||||
|
||||
struct {
|
||||
int idle_timeout; /* NCP Idle timeout value */
|
||||
struct {
|
||||
char name[50]; /* PAP/CHAP system name */
|
||||
char key[50]; /* PAP/CHAP key */
|
||||
} auth;
|
||||
} cfg;
|
||||
|
||||
struct {
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: chap.c,v 1.28.2.18 1998/03/16 22:53:34 brian Exp $
|
||||
* $Id: chap.c,v 1.28.2.19 1998/04/03 19:21:10 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -110,8 +110,8 @@ SendChapChallenge(struct authinfo *auth, int chapid, struct physical *physical)
|
||||
*cp++ = chap->challenge_len = random() % 32 + 16;
|
||||
for (i = 0; i < chap->challenge_len; i++)
|
||||
*cp++ = random() & 0xff;
|
||||
len = strlen(VarAuthName);
|
||||
memcpy(cp, VarAuthName, len);
|
||||
len = strlen(physical->dl->bundle->cfg.auth.name);
|
||||
memcpy(cp, physical->dl->bundle->cfg.auth.name, len);
|
||||
cp += len;
|
||||
ChapOutput(physical, CHAP_CHALLENGE, chapid, chap->challenge_data,
|
||||
cp - chap->challenge_data);
|
||||
@ -146,10 +146,10 @@ RecvChapTalk(struct bundle *bundle, struct fsmheader *chp, struct mbuf *bp,
|
||||
|
||||
switch (chp->code) {
|
||||
case CHAP_CHALLENGE:
|
||||
keyp = VarAuthKey;
|
||||
keylen = strlen(VarAuthKey);
|
||||
name = VarAuthName;
|
||||
namelen = strlen(VarAuthName);
|
||||
keyp = bundle->cfg.auth.key;
|
||||
keylen = strlen(bundle->cfg.auth.key);
|
||||
name = bundle->cfg.auth.name;
|
||||
namelen = strlen(bundle->cfg.auth.name);
|
||||
|
||||
#ifdef HAVE_DES
|
||||
if (VarMSChap)
|
||||
|
@ -23,11 +23,13 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: chat.c,v 1.44.2.17 1998/03/20 19:47:47 brian Exp $
|
||||
* $Id: chat.c,v 1.44.2.18 1998/04/03 19:21:11 brian Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
@ -62,6 +64,16 @@
|
||||
#include "physical.h"
|
||||
#include "chat.h"
|
||||
#include "prompt.h"
|
||||
#include "mp.h"
|
||||
#include "auth.h"
|
||||
#include "pap.h"
|
||||
#include "chap.h"
|
||||
#include "slcompress.h"
|
||||
#include "iplist.h"
|
||||
#include "ipcp.h"
|
||||
#include "filter.h"
|
||||
#include "datalink.h"
|
||||
#include "bundle.h"
|
||||
|
||||
#define BUFLEFT(c) (sizeof (c)->buf - ((c)->bufend - (c)->buf))
|
||||
#define issep(c) ((c) == '\t' || (c) == ' ')
|
||||
@ -621,7 +633,7 @@ MakeArgs(char *script, char **pvect, int maxargs)
|
||||
* \t Tab character
|
||||
* \U Auth User
|
||||
*/
|
||||
char *
|
||||
static char *
|
||||
ExpandString(struct chat *c, const char *str, char *result, int reslen,
|
||||
int sendmode)
|
||||
{
|
||||
@ -662,7 +674,7 @@ ExpandString(struct chat *c, const char *str, char *result, int reslen,
|
||||
reslen--;
|
||||
break;
|
||||
case 'P':
|
||||
strncpy(result, VarAuthKey, reslen);
|
||||
strncpy(result, c->physical->dl->bundle->cfg.auth.key, reslen);
|
||||
reslen -= strlen(result);
|
||||
result += strlen(result);
|
||||
break;
|
||||
@ -672,7 +684,7 @@ ExpandString(struct chat *c, const char *str, char *result, int reslen,
|
||||
result += strlen(result);
|
||||
break;
|
||||
case 'U':
|
||||
strncpy(result, VarAuthName, reslen);
|
||||
strncpy(result, c->physical->dl->bundle->cfg.auth.name, reslen);
|
||||
reslen -= strlen(result);
|
||||
result += strlen(result);
|
||||
break;
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: command.c,v 1.131.2.46 1998/04/03 19:24:15 brian Exp $
|
||||
* $Id: command.c,v 1.131.2.47 1998/04/03 19:24:29 brian Exp $
|
||||
*
|
||||
*/
|
||||
#include <sys/param.h>
|
||||
@ -456,7 +456,7 @@ ShowStopped(struct cmdargs const *arg)
|
||||
static int
|
||||
ShowAuthKey(struct cmdargs const *arg)
|
||||
{
|
||||
prompt_Printf(&prompt, "AuthName = %s\n", VarAuthName);
|
||||
prompt_Printf(&prompt, "AuthName = %s\n", arg->bundle->cfg.auth.name);
|
||||
prompt_Printf(&prompt, "AuthKey = %s\n", HIDDEN);
|
||||
#ifdef HAVE_DES
|
||||
prompt_Printf(&prompt, "Encrypt = %s\n", VarMSChap ? "MSChap" : "MD5" );
|
||||
@ -1208,12 +1208,24 @@ SetVariable(struct cmdargs const *arg)
|
||||
|
||||
switch (param) {
|
||||
case VAR_AUTHKEY:
|
||||
strncpy(VarAuthKey, argp, sizeof VarAuthKey - 1);
|
||||
VarAuthKey[sizeof VarAuthKey - 1] = '\0';
|
||||
if (bundle_Phase(arg->bundle) == PHASE_DEAD) {
|
||||
strncpy(arg->bundle->cfg.auth.key, argp,
|
||||
sizeof arg->bundle->cfg.auth.key - 1);
|
||||
arg->bundle->cfg.auth.key[sizeof arg->bundle->cfg.auth.key - 1] = '\0';
|
||||
} else {
|
||||
err = "set authkey: Only available at phase DEAD\n";
|
||||
LogPrintf(LogWARN, err);
|
||||
}
|
||||
break;
|
||||
case VAR_AUTHNAME:
|
||||
strncpy(VarAuthName, argp, sizeof VarAuthName - 1);
|
||||
VarAuthName[sizeof VarAuthName - 1] = '\0';
|
||||
if (bundle_Phase(arg->bundle) == PHASE_DEAD) {
|
||||
strncpy(arg->bundle->cfg.auth.name, argp,
|
||||
sizeof arg->bundle->cfg.auth.name - 1);
|
||||
arg->bundle->cfg.auth.name[sizeof arg->bundle->cfg.auth.name - 1] = '\0';
|
||||
} else {
|
||||
err = "set authname: Only available at phase DEAD\n";
|
||||
LogPrintf(LogWARN, err);
|
||||
}
|
||||
break;
|
||||
case VAR_DIAL:
|
||||
if (!(mode & (MODE_DIRECT|MODE_DEDICATED))) {
|
||||
|
@ -18,7 +18,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: pap.c,v 1.20.2.19 1998/03/16 22:54:16 brian Exp $
|
||||
* $Id: pap.c,v 1.20.2.20 1998/04/03 19:21:47 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -79,15 +79,12 @@ SendPapChallenge(struct authinfo *auth, int papid, struct physical *physical)
|
||||
u_char *cp;
|
||||
int namelen, keylen, plen;
|
||||
|
||||
namelen = strlen(VarAuthName);
|
||||
keylen = strlen(VarAuthKey);
|
||||
namelen = strlen(physical->dl->bundle->cfg.auth.name);
|
||||
keylen = strlen(physical->dl->bundle->cfg.auth.key);
|
||||
plen = namelen + keylen + 2;
|
||||
LogPrintf(LogDEBUG, "SendPapChallenge: namelen = %d, keylen = %d\n",
|
||||
namelen, keylen);
|
||||
if (LogIsKept(LogDEBUG))
|
||||
LogPrintf(LogPHASE, "PAP: %s (%s)\n", VarAuthName, VarAuthKey);
|
||||
else
|
||||
LogPrintf(LogPHASE, "PAP: %s\n", VarAuthName);
|
||||
LogPrintf(LogPHASE, "PAP: %s\n", physical->dl->bundle->cfg.auth.name);
|
||||
lh.code = PAP_REQUEST;
|
||||
lh.id = papid;
|
||||
lh.length = htons(plen + sizeof(struct fsmheader));
|
||||
@ -95,10 +92,11 @@ SendPapChallenge(struct authinfo *auth, int papid, struct physical *physical)
|
||||
memcpy(MBUF_CTOP(bp), &lh, sizeof(struct fsmheader));
|
||||
cp = MBUF_CTOP(bp) + sizeof(struct fsmheader);
|
||||
*cp++ = namelen;
|
||||
memcpy(cp, VarAuthName, namelen);
|
||||
memcpy(cp, physical->dl->bundle->cfg.auth.name, namelen);
|
||||
cp += namelen;
|
||||
*cp++ = keylen;
|
||||
memcpy(cp, VarAuthKey, keylen);
|
||||
memcpy(cp, physical->dl->bundle->cfg.auth.key, keylen);
|
||||
|
||||
|
||||
HdlcOutput(physical2link(physical), PRI_LINK, PROTO_PAP, bp);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: vars.c,v 1.45.2.20 1998/04/03 19:24:22 brian Exp $
|
||||
* $Id: vars.c,v 1.45.2.21 1998/04/03 19:24:36 brian Exp $
|
||||
*
|
||||
*/
|
||||
#include <sys/param.h>
|
||||
@ -48,7 +48,7 @@
|
||||
#include "prompt.h"
|
||||
|
||||
char VarVersion[] = "PPP Version 2.0-beta";
|
||||
char VarLocalVersion[] = "$Date: 1998/04/03 19:24:22 $";
|
||||
char VarLocalVersion[] = "$Date: 1998/04/03 19:24:36 $";
|
||||
|
||||
/*
|
||||
* Order of conf option is important. See vars.h.
|
||||
@ -69,8 +69,7 @@ struct confdesc pppConfs[NCONFS] = {
|
||||
{"throughput", CONF_DISABLE, CONF_NONE},
|
||||
{"utmp", CONF_ENABLE, CONF_NONE},
|
||||
{"idcheck", CONF_ENABLE, CONF_NONE},
|
||||
{"loopback", CONF_ENABLE, CONF_NONE},
|
||||
{NULL},
|
||||
{"loopback", CONF_ENABLE, CONF_NONE}
|
||||
};
|
||||
|
||||
struct pppvars pppVars = {
|
||||
|
@ -15,7 +15,7 @@
|
||||
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* $Id: vars.h,v 1.42.2.17 1998/04/03 19:24:23 brian Exp $
|
||||
* $Id: vars.h,v 1.42.2.18 1998/04/03 19:24:36 brian Exp $
|
||||
*
|
||||
* TODO:
|
||||
*/
|
||||
@ -65,8 +65,6 @@ struct pppvars {
|
||||
u_char lauth; /* Local Authorized status */
|
||||
|
||||
/* The rest are just default initialized in vars.c */
|
||||
char auth_key[50]; /* PAP/CHAP key */
|
||||
char auth_name[50]; /* PAP/CHAP system name */
|
||||
char local_auth_key[50]; /* Local auth passwd */
|
||||
int have_local_auth_key; /* Local auth passwd specified ? */
|
||||
int use_MSChap; /* Use MSCHAP encryption */
|
||||
@ -76,8 +74,6 @@ struct pppvars {
|
||||
|
||||
#define VarLocalAuth pppVars.lauth
|
||||
|
||||
#define VarAuthKey pppVars.auth_key
|
||||
#define VarAuthName pppVars.auth_name
|
||||
#define VarLocalAuthKey pppVars.local_auth_key
|
||||
#define VarHaveLocalAuthKey pppVars.have_local_auth_key
|
||||
#define VarMSChap pppVars.use_MSChap
|
||||
|
Loading…
Reference in New Issue
Block a user