diff --git a/usr.sbin/ppp/arp.c b/usr.sbin/ppp/arp.c index 028f523f4cdd..9d89c0d396a0 100644 --- a/usr.sbin/ppp/arp.c +++ b/usr.sbin/ppp/arp.c @@ -179,7 +179,8 @@ arp_SetProxy(struct bundle *bundle, struct in_addr addr, int s) * address. */ if (!get_ether_addr(s, addr, &dls.sdl)) { - log_Printf(LOG_PHASE_BIT, "Cannot determine ethernet address for proxy ARP\n"); + log_Printf(LOG_PHASE_BIT, "Cannot determine ethernet address for " + "proxy ARP\n"); return 0; } arpreq.arp_ha.sa_len = sizeof(struct sockaddr); diff --git a/usr.sbin/ppp/ccp.c b/usr.sbin/ppp/ccp.c index 4366863de86a..255d780cc1ae 100644 --- a/usr.sbin/ppp/ccp.c +++ b/usr.sbin/ppp/ccp.c @@ -500,8 +500,8 @@ CcpDecodeConfig(struct fsm *fp, u_char *cp, int plen, int mode_type, if (o->val.id == cp[0]) break; if (o == NULL) - log_Printf(LogCCP, "%s: Warning: Ignoring peer NAK of unsent option\n", - fp->link->name); + log_Printf(LogCCP, "%s: Warning: Ignoring peer NAK of unsent" + " option\n", fp->link->name); else { memcpy(&o->val, cp, length); if ((*algorithm[f]->o.Set)(&o->val) == MODE_ACK) diff --git a/usr.sbin/ppp/chap.c b/usr.sbin/ppp/chap.c index 406931b85530..be41362aa710 100644 --- a/usr.sbin/ppp/chap.c +++ b/usr.sbin/ppp/chap.c @@ -509,7 +509,8 @@ chap_Challenge(struct authinfo *authp) struct chap *chap = auth2chap(authp); int len; - log_Printf(LogDEBUG, "CHAP%02X: Challenge\n", authp->physical->link.lcp.want_authtype); + log_Printf(LogDEBUG, "CHAP%02X: Challenge\n", + authp->physical->link.lcp.want_authtype); len = strlen(authp->physical->dl->bundle->cfg.auth.name); @@ -530,7 +531,7 @@ chap_Challenge(struct authinfo *authp) static void chap_Success(struct authinfo *authp) { - char *msg; + const char *msg; datalink_GotAuthname(authp->physical->dl, authp->in.name); #ifdef HAVE_DES if (authp->physical->link.lcp.want_authtype == 0x81) { @@ -561,18 +562,19 @@ chap_Failure(struct authinfo *authp) #ifdef HAVE_DES char buf[1024]; #endif - char *msg; + const char *msg; #ifdef HAVE_DES if (authp->physical->link.lcp.want_authtype == 0x81) { + char *ptr; int i; - msg = buf; - msg += sprintf(buf, "E=691 R=0 C="); + ptr = buf; + ptr += sprintf(buf, "E=691 R=0 C="); for (i=0; i<16; i++) - msg += sprintf(msg, "%02X", *(auth2chap(authp)->challenge.local+1+i)); + ptr += sprintf(ptr, "%02X", *(auth2chap(authp)->challenge.local+1+i)); - sprintf(msg, " V=3 M=Invalid!"); + sprintf(ptr, " V=3 M=Invalid!"); msg = buf; } else #endif @@ -889,7 +891,8 @@ chap_Input(struct bundle *bundle, struct link *l, struct mbuf *bp) if (p->link.lcp.his_authtype == 0x81) { if (strncmp(ans, chap->authresponse, 42)) { datalink_AuthNotOk(p->dl); - log_Printf(LogDEBUG, "CHAP81: AuthenticatorResponse: (%s) != ans: (%s)\n", chap->authresponse, ans); + log_Printf(LogDEBUG, "CHAP81: AuthenticatorResponse: (%s)" + " != ans: (%s)\n", chap->authresponse, ans); } else { /* Successful login */ diff --git a/usr.sbin/ppp/chap_ms.c b/usr.sbin/ppp/chap_ms.c index c2892c47540c..a3df295acede 100644 --- a/usr.sbin/ppp/chap_ms.c +++ b/usr.sbin/ppp/chap_ms.c @@ -65,7 +65,8 @@ struct MS_ChapResponse { u_char UseNT; /* If 1, ignore the LANMan response field */ }; -static u_char Get7Bits(u_char *input, int startBit) +static u_char +Get7Bits(u_char *input, int startBit) { register unsigned int word; @@ -79,7 +80,8 @@ static u_char Get7Bits(u_char *input, int startBit) /* IN 56 bit DES key missing parity bits OUT 64 bit DES key with parity bits added */ -static void MakeKey(u_char *key, u_char *des_key) +static void +MakeKey(u_char *key, u_char *des_key) { des_key[0] = Get7Bits(key, 0); des_key[1] = Get7Bits(key, 7); @@ -118,7 +120,8 @@ ChallengeResponse(u_char *challenge, u_char *pwHash, u_char *response) } void -NtPasswordHash(char *key, int keylen, char *hash) { +NtPasswordHash(char *key, int keylen, char *hash) +{ MD4_CTX MD4context; MD4Init(&MD4context); @@ -127,7 +130,8 @@ NtPasswordHash(char *key, int keylen, char *hash) { } void -HashNtPasswordHash(char *hash, char *hashhash) { +HashNtPasswordHash(char *hash, char *hashhash) +{ MD4_CTX MD4context; MD4Init(&MD4context); @@ -136,7 +140,9 @@ HashNtPasswordHash(char *hash, char *hashhash) { } void -ChallengeHash(char *PeerChallenge, char *AuthenticatorChallenge, char *UserName, int UserNameLen, char *Challenge) { +ChallengeHash(char *PeerChallenge, char *AuthenticatorChallenge, + char *UserName, int UserNameLen, char *Challenge) +{ SHA_CTX Context; char Digest[SHA_DIGEST_LENGTH]; char *Name; @@ -158,7 +164,10 @@ ChallengeHash(char *PeerChallenge, char *AuthenticatorChallenge, char *UserName, } void -GenerateNTResponse(char *AuthenticatorChallenge, char *PeerChallenge, char *UserName, int UserNameLen, char *Password, int PasswordLen, char *Response) { +GenerateNTResponse(char *AuthenticatorChallenge, char *PeerChallenge, + char *UserName, int UserNameLen, char *Password, + int PasswordLen, char *Response) +{ char Challenge[8]; char PasswordHash[16]; @@ -169,7 +178,11 @@ GenerateNTResponse(char *AuthenticatorChallenge, char *PeerChallenge, char *User } void -GenerateAuthenticatorResponse(char *Password, int PasswordLen, char *NTResponse, char *PeerChallenge, char *AuthenticatorChallenge, char *UserName, int UserNameLen, char *AuthenticatorResponse) { +GenerateAuthenticatorResponse(char *Password, int PasswordLen, + char *NTResponse, char *PeerChallenge, + char *AuthenticatorChallenge, char *UserName, + int UserNameLen, char *AuthenticatorResponse) +{ SHA_CTX Context; char PasswordHash[16]; char PasswordHashHash[16]; @@ -230,7 +243,8 @@ GenerateAuthenticatorResponse(char *Password, int PasswordLen, char *NTResponse, } void -GetMasterKey(char *PasswordHashHash, char *NTResponse, char *MasterKey) { +GetMasterKey(char *PasswordHashHash, char *NTResponse, char *MasterKey) +{ char Digest[SHA_DIGEST_LENGTH]; SHA_CTX Context; static char Magic1[27] = @@ -247,7 +261,9 @@ GetMasterKey(char *PasswordHashHash, char *NTResponse, char *MasterKey) { } void -GetAsymetricStartKey(char *MasterKey, char *SessionKey, int SessionKeyLength, int IsSend, int IsServer) { +GetAsymetricStartKey(char *MasterKey, char *SessionKey, int SessionKeyLength, + int IsSend, int IsServer) +{ char Digest[SHA_DIGEST_LENGTH]; SHA_CTX Context; char *s; @@ -299,7 +315,9 @@ GetAsymetricStartKey(char *MasterKey, char *SessionKey, int SessionKeyLength, in } void -GetNewKeyFromSHA(char *StartKey, char *SessionKey, long SessionKeyLength, char *InterimKey) { +GetNewKeyFromSHA(char *StartKey, char *SessionKey, long SessionKeyLength, + char *InterimKey) +{ SHA_CTX Context; char Digest[SHA_DIGEST_LENGTH]; @@ -313,8 +331,11 @@ GetNewKeyFromSHA(char *StartKey, char *SessionKey, long SessionKeyLength, char * memcpy(InterimKey, Digest, SessionKeyLength); } -void -Get_Key(char *InitialSessionKey, char *CurrentSessionKey, int LengthOfDesiredKey) { +#if 0 +static void +Get_Key(char *InitialSessionKey, char *CurrentSessionKey, + int LengthOfDesiredKey) +{ SHA_CTX Context; char Digest[SHA_DIGEST_LENGTH]; @@ -327,6 +348,7 @@ Get_Key(char *InitialSessionKey, char *CurrentSessionKey, int LengthOfDesiredKey memcpy(CurrentSessionKey, Digest, LengthOfDesiredKey); } +#endif /* passwordHash 16-bytes MD4 hashed password challenge 8-bytes peer CHAP challenge diff --git a/usr.sbin/ppp/datalink.c b/usr.sbin/ppp/datalink.c index 619c14f46eb7..84b9af7396e7 100644 --- a/usr.sbin/ppp/datalink.c +++ b/usr.sbin/ppp/datalink.c @@ -474,7 +474,8 @@ datalink_Read(struct fdescriptor *d, struct bundle *bundle, const fd_set *fdset) } static int -datalink_Write(struct fdescriptor *d, struct bundle *bundle, const fd_set *fdset) +datalink_Write(struct fdescriptor *d, struct bundle *bundle, + const fd_set *fdset) { struct datalink *dl = descriptor2datalink(d); int result = 0; diff --git a/usr.sbin/ppp/filter.c b/usr.sbin/ppp/filter.c index 3f0293b84247..99c36eedc0c4 100644 --- a/usr.sbin/ppp/filter.c +++ b/usr.sbin/ppp/filter.c @@ -502,9 +502,11 @@ Parse(struct ipcp *ipcp, int argc, char const *const *argv, } log_Printf(LogDEBUG, "Parse: Src: %s\n", inet_ntoa(filterdata.f_src.ipaddr)); - log_Printf(LogDEBUG, "Parse: Src mask: %s\n", inet_ntoa(filterdata.f_src.mask)); + log_Printf(LogDEBUG, "Parse: Src mask: %s\n", + inet_ntoa(filterdata.f_src.mask)); log_Printf(LogDEBUG, "Parse: Dst: %s\n", inet_ntoa(filterdata.f_dst.ipaddr)); - log_Printf(LogDEBUG, "Parse: Dst mask: %s\n", inet_ntoa(filterdata.f_dst.mask)); + log_Printf(LogDEBUG, "Parse: Dst mask: %s\n", + inet_ntoa(filterdata.f_dst.mask)); log_Printf(LogDEBUG, "Parse: Proto = %d\n", proto); log_Printf(LogDEBUG, "Parse: src: %s (%d)\n", diff --git a/usr.sbin/ppp/lcp.c b/usr.sbin/ppp/lcp.c index 096b59b34120..b0d1e812ef57 100644 --- a/usr.sbin/ppp/lcp.c +++ b/usr.sbin/ppp/lcp.c @@ -308,7 +308,8 @@ lcp_Setup(struct lcp *lcp, int openmode) } if (p->type != PHYS_DIRECT) - memcpy(&lcp->want_callback, &p->dl->cfg.callback, sizeof(struct callback)); + memcpy(&lcp->want_callback, &p->dl->cfg.callback, + sizeof(struct callback)); else lcp->want_callback.opmask = 0; lcp->want_lqrperiod = IsEnabled(lcp->cfg.lqr) ? diff --git a/usr.sbin/ppp/log.c b/usr.sbin/ppp/log.c index 1b32941f367d..df3b131a680a 100644 --- a/usr.sbin/ppp/log.c +++ b/usr.sbin/ppp/log.c @@ -435,7 +435,8 @@ log_SetLevel(struct cmdargs const *arg) local = 0; else { if (arg->prompt == NULL) { - log_Printf(LogWARN, "set log local: Only available on the command line\n"); + log_Printf(LogWARN, "set log local: Only available on the" + " command line\n"); return 1; } argc--; diff --git a/usr.sbin/ppp/main.c b/usr.sbin/ppp/main.c index 731ef772564b..6b72b76b35f9 100644 --- a/usr.sbin/ppp/main.c +++ b/usr.sbin/ppp/main.c @@ -168,8 +168,8 @@ BringDownServer(int signo) static void Usage(void) { - fprintf(stderr, - "Usage: ppp [-auto | -foreground | -background | -direct | -dedicated | -ddial | -interactive]" + fprintf(stderr, "Usage: ppp [-auto | -foreground | -background | -direct |" + " -dedicated | -ddial | -interactive]" #ifndef NOALIAS " [-nat]" #endif diff --git a/usr.sbin/ppp/mp.c b/usr.sbin/ppp/mp.c index 1b63174dbef6..2652d465baf5 100644 --- a/usr.sbin/ppp/mp.c +++ b/usr.sbin/ppp/mp.c @@ -1076,7 +1076,8 @@ mpserver_Read(struct fdescriptor *d, struct bundle *bundle, const fd_set *fdset) } static int -mpserver_Write(struct fdescriptor *d, struct bundle *bundle, const fd_set *fdset) +mpserver_Write(struct fdescriptor *d, struct bundle *bundle, + const fd_set *fdset) { /* We never want to write here ! */ log_Printf(LogALERT, "mpserver_Write: Internal error: Bad call !\n"); diff --git a/usr.sbin/ppp/mppe.c b/usr.sbin/ppp/mppe.c index 0257d2f83409..85576fe731df 100644 --- a/usr.sbin/ppp/mppe.c +++ b/usr.sbin/ppp/mppe.c @@ -71,8 +71,9 @@ MPPEResetOutput(void *v) log_Printf(LogCCP, "MPPE: Output channel reset\n"); } -void -MPPEReduceSessionKey(struct mppe_state *mp) { +static void +MPPEReduceSessionKey(struct mppe_state *mp) +{ switch(mp->keybits) { case 40: mp->sesskey[2] = 0x9e; @@ -83,8 +84,9 @@ MPPEReduceSessionKey(struct mppe_state *mp) { } } -void -MPPEKeyChange(struct mppe_state *mp) { +static void +MPPEKeyChange(struct mppe_state *mp) +{ char InterimKey[MPPE_KEY_LEN]; RC4_KEY RC4Key; @@ -143,7 +145,8 @@ MPPEOutput(void *v, struct ccp *ccp, struct link *l, int pri, u_short *proto, /* Chage protocol number */ *proto = ccp_Proto(ccp); - log_Printf(LogDEBUG, "MPPE: Output: Encrypted: Proto %02x (%d bytes)\n", *proto, m_length(mo)); + log_Printf(LogDEBUG, "MPPE: Output: Encrypted: Proto %02x (%d bytes)\n", + *proto, m_length(mo)); return mo; } @@ -193,7 +196,8 @@ MPPEInput(void *v, struct ccp *ccp, u_short *proto, struct mbuf *mp) rp = MBUF_CTOP(mp); RC4(&mip->rc4key, m_length(mp), rp, rp); - log_Printf(LogDEBUG, "MPPE: Input: Decrypted: Proto %02x (%d bytes)\n", *proto, m_length(mp)); + log_Printf(LogDEBUG, "MPPE: Input: Decrypted: Proto %02x (%d bytes)\n", + *proto, m_length(mp)); log_DumpBp(LogDEBUG, "MPPE: Input: Decrypted: Packet:", mp); @@ -224,7 +228,8 @@ MPPEInitOptsOutput(struct lcp_opt *o, const struct ccp_config *cfg) log_Printf(LogCCP, "MPPE: InitOptsOutput\n"); if (!MPPE_MasterKeyValid) { - log_Printf(LogWARN, "MPPE: MasterKey is invalid, MPPE is capable only with CHAP81 authentication\n"); + log_Printf(LogWARN, "MPPE: MasterKey is invalid," + " MPPE is capable only with CHAP81 authentication\n"); *(u_int32_t *)o->data = htonl(0x0); return; } @@ -419,4 +424,3 @@ const struct ccp_algorithm MPPEAlgorithm = { MPPEOutput }, }; - diff --git a/usr.sbin/ppp/server.c b/usr.sbin/ppp/server.c index 5bd089636a25..a87545c134c1 100644 --- a/usr.sbin/ppp/server.c +++ b/usr.sbin/ppp/server.c @@ -218,7 +218,8 @@ server_LocalOpen(struct bundle *bundle, const char *name, mode_t mask) if (mask != (mode_t)-1) umask(mask); if (listen(s, 5) != 0) { - log_Printf(LogERROR, "Local: Unable to listen to socket - BUNDLE overload?\n"); + log_Printf(LogERROR, "Local: Unable to listen to socket -" + " BUNDLE overload?\n"); close(s); ID0unlink(name); return 5;