summaryrefslogtreecommitdiff
path: root/accel-pppd/auth
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2014-11-22 08:56:40 +0300
committerDmitry Kozlov <xeb@mail.ru>2014-11-22 08:56:40 +0300
commit81ca3923a29ea9b67f7291be23b210019546aa5f (patch)
treefcebf0d426665b4f06e01168f27cd8f9ab8c50d8 /accel-pppd/auth
parent830c399cf126f6bf1e8dfa1ad919a3ce8e346c5d (diff)
downloadaccel-ppp-81ca3923a29ea9b67f7291be23b210019546aa5f.tar.gz
accel-ppp-81ca3923a29ea9b67f7291be23b210019546aa5f.zip
remove trailing whitespaces
Diffstat (limited to 'accel-pppd/auth')
-rw-r--r--accel-pppd/auth/auth_chap_md5.c18
-rw-r--r--accel-pppd/auth/auth_mschap_v1.c20
-rw-r--r--accel-pppd/auth/auth_mschap_v2.c36
-rw-r--r--accel-pppd/auth/auth_pap.c20
4 files changed, 47 insertions, 47 deletions
diff --git a/accel-pppd/auth/auth_chap_md5.c b/accel-pppd/auth/auth_chap_md5.c
index 5be8b875..9df39eff 100644
--- a/accel-pppd/auth/auth_chap_md5.c
+++ b/accel-pppd/auth/auth_chap_md5.c
@@ -147,7 +147,7 @@ static int chap_finish(struct ppp_t *ppp, struct auth_data_t *auth)
if (d->interval.tpd)
triton_timer_del(&d->interval);
-
+
if (d->name)
_free(d->name);
@@ -175,7 +175,7 @@ static void chap_timeout_timer(struct triton_timer_t *t)
static void chap_restart_timer(struct triton_timer_t *t)
{
struct chap_auth_data *d = container_of(t, typeof(*d), interval);
-
+
chap_send_challenge(d, 1);
}
@@ -201,7 +201,7 @@ static void chap_send_failure(struct chap_auth_data *ad)
.hdr.len = htons(sizeof(msg) - 1 - 2),
.message = MSG_FAILURE,
};
-
+
if (conf_ppp_verbose)
log_ppp_info2("send [CHAP Failure id=%x \"%s\"]\n", msg.hdr.id, MSG_FAILURE);
@@ -217,7 +217,7 @@ static void chap_send_success(struct chap_auth_data *ad, int id)
.hdr.len = htons(sizeof(msg)-1-2),
.message = MSG_SUCCESS,
};
-
+
if (conf_ppp_verbose)
log_ppp_info2("send [CHAP Success id=%x \"%s\"]\n", msg.hdr.id, MSG_SUCCESS);
@@ -301,7 +301,7 @@ static void chap_recv_response(struct chap_auth_data *ad, struct chap_hdr *hdr)
print_str(msg->name, ntohs(msg->hdr.len) - sizeof(*msg) + 2);
log_ppp_info2("\"]\n");
}
-
+
if (ad->started && msg->hdr.id == ad->id - 1) {
chap_send_success(ad, msg->hdr.id);
return;
@@ -364,7 +364,7 @@ static void chap_recv_response(struct chap_auth_data *ad, struct chap_hdr *hdr)
MD5_Update(&md5_ctx,passwd,strlen(passwd));
MD5_Update(&md5_ctx,ad->val,VALUE_SIZE);
MD5_Final(md5,&md5_ctx);
-
+
if (memcmp(md5,msg->val,sizeof(md5)))
{
if (conf_ppp_verbose)
@@ -389,7 +389,7 @@ static void chap_recv_response(struct chap_auth_data *ad, struct chap_hdr *hdr)
}
} else
_free(name);
-
+
ad->id++;
}
_free(passwd);
@@ -429,7 +429,7 @@ static int chap_check(uint8_t *ptr)
static int chap_restart(struct ppp_t *ppp, struct auth_data_t *auth)
{
struct chap_auth_data *d = container_of(auth, typeof(*d), auth);
-
+
chap_send_challenge(d, 1);
return 0;
@@ -491,7 +491,7 @@ static void auth_chap_md5_init()
if (ppp_auth_register_handler(&chap))
log_emerg("chap-md5: failed to register handler\n");
-
+
triton_event_register_handler(EV_CONFIG_RELOAD, (triton_event_func)load_config);
}
diff --git a/accel-pppd/auth/auth_mschap_v1.c b/accel-pppd/auth/auth_mschap_v1.c
index d9232cc9..bf78f23e 100644
--- a/accel-pppd/auth/auth_mschap_v1.c
+++ b/accel-pppd/auth/auth_mschap_v1.c
@@ -176,7 +176,7 @@ static void chap_timeout_timer(struct triton_timer_t *t)
static void chap_restart_timer(struct triton_timer_t *t)
{
struct chap_auth_data *d = container_of(t, typeof(*d), interval);
-
+
chap_send_challenge(d, 1);
}
@@ -218,7 +218,7 @@ static void chap_send_success(struct chap_auth_data *ad, int id)
hdr->id = id;
hdr->len = htons(HDR_LEN + strlen(conf_msg_success));
strcpy((char *)(hdr + 1), conf_msg_success);
-
+
if (conf_ppp_verbose)
log_ppp_info2("send [MSCHAP-v1 Success id=%x \"%s\"]\n", hdr->id, conf_msg_success);
@@ -278,14 +278,14 @@ static void auth_result(struct chap_auth_data *ad, int res)
name = NULL;
}
}
-
+
ad->id++;
if (ad->mschap_error != conf_msg_failure) {
_free(ad->mschap_error);
ad->mschap_error = conf_msg_failure;
}
-
+
if (name)
_free(name);
}
@@ -358,7 +358,7 @@ static void chap_recv_response(struct chap_auth_data *ad, struct chap_hdr *hdr)
ad->mschap_error = conf_msg_failure;
r = pwdb_check(&ad->ppp->ses, (pwdb_callback)auth_result, ad, name, PPP_CHAP, MSCHAP_V1, ad->id, ad->val, VALUE_SIZE, msg->lm_hash, msg->nt_hash, msg->flags, &ad->mschap_error);
-
+
if (r == PWDB_WAIT) {
ad->name = name;
return;
@@ -367,7 +367,7 @@ static void chap_recv_response(struct chap_auth_data *ad, struct chap_hdr *hdr)
if (r == PWDB_NO_IMPL)
if (chap_check_response(ad, msg, name))
r = PWDB_DENIED;
-
+
if (r == PWDB_DENIED) {
chap_send_failure(ad, ad->mschap_error);
if (ad->started)
@@ -426,7 +426,7 @@ static void des_encrypt(const uint8_t *input, const uint8_t *key, uint8_t *outpu
DES_set_key_checked(&cb, &ks);
memcpy(cb, input, 8);
DES_ecb_encrypt(&cb, &res, &ks, DES_ENCRYPT);
- memcpy(output, res, 8);
+ memcpy(output, res, 8);
}
static int chap_check_response(struct chap_auth_data *ad, struct chap_response *msg, const char *name)
@@ -437,7 +437,7 @@ static int chap_check_response(struct chap_auth_data *ad, struct chap_response *
char *passwd;
char *u_passwd;
int i;
-
+
passwd = pwdb_get_passwd(&ad->ppp->ses, name);
if (!passwd) {
if (conf_ppp_verbose)
@@ -497,7 +497,7 @@ static void set_mppe_keys(struct chap_auth_data *ad, uint8_t *z_hash)
SHA1_Update(&sha_ctx, digest, 16);
SHA1_Update(&sha_ctx, digest, 16);
SHA1_Update(&sha_ctx, ad->val, VALUE_SIZE);
- SHA1_Final(digest, &sha_ctx);
+ SHA1_Final(digest, &sha_ctx);
triton_event_fire(EV_MPPE_KEYS, &ev_mppe);
}
@@ -505,7 +505,7 @@ static void set_mppe_keys(struct chap_auth_data *ad, uint8_t *z_hash)
static int chap_restart(struct ppp_t *ppp, struct auth_data_t *auth)
{
struct chap_auth_data *d = container_of(auth, typeof(*d), auth);
-
+
chap_send_challenge(d, 1);
return 0;
diff --git a/accel-pppd/auth/auth_mschap_v2.c b/accel-pppd/auth/auth_mschap_v2.c
index 0235ddf0..f416c434 100644
--- a/accel-pppd/auth/auth_mschap_v2.c
+++ b/accel-pppd/auth/auth_mschap_v2.c
@@ -19,7 +19,7 @@
#include "memdebug.h"
-#define MSCHAP_V2 0x81
+#define MSCHAP_V2 0x81
#define CHAP_CHALLENGE 1
#define CHAP_RESPONSE 2
@@ -119,7 +119,7 @@ static void auth_data_free(struct ppp_t *ppp, struct auth_data_t *auth)
if (d->interval.tpd)
triton_timer_del(&d->interval);
-
+
_free(d);
}
@@ -177,7 +177,7 @@ static void chap_timeout_timer(struct triton_timer_t *t)
static void chap_restart_timer(struct triton_timer_t *t)
{
struct chap_auth_data *d = container_of(t, typeof(*d), interval);
-
+
chap_send_challenge(d, 1);
}
@@ -203,7 +203,7 @@ static void chap_send_failure(struct chap_auth_data *ad, char *mschap_error, cha
hdr->len = htons(HDR_LEN + strlen(mschap_error) + strlen(reply_msg) + 3);
sprintf((char *)(hdr + 1), "%s M=%s", mschap_error, reply_msg);
-
+
if (conf_ppp_verbose)
log_ppp_info2("send [MSCHAP-v2 Failure id=%x \"%s\"]\n", hdr->id, (char *)(hdr + 1));
@@ -240,7 +240,7 @@ static int generate_response(struct chap_auth_data *ad, struct chap_response *ms
uint8_t c_hash[SHA_DIGEST_LENGTH];
uint8_t response[SHA_DIGEST_LENGTH];
int i;
-
+
uint8_t magic1[39] =
{0x4D, 0x61, 0x67, 0x69, 0x63, 0x20, 0x73, 0x65, 0x72, 0x76,
0x65, 0x72, 0x20, 0x74, 0x6F, 0x20, 0x63, 0x6C, 0x69, 0x65,
@@ -290,10 +290,10 @@ static int generate_response(struct chap_auth_data *ad, struct chap_response *ms
SHA1_Update(&sha_ctx,c_hash,8);
SHA1_Update(&sha_ctx,magic2,41);
SHA1_Final(response,&sha_ctx);
-
+
for(i=0; i<20; i++)
sprintf(authenticator+i*2,"%02X",response[i]);
-
+
_free(passwd);
_free(u_passwd);
@@ -351,19 +351,19 @@ static void auth_result(struct chap_auth_data *ad, int res)
name = NULL;
}
}
-
+
ad->id++;
if (ad->mschap_error != conf_msg_failure) {
_free(ad->mschap_error);
ad->mschap_error = conf_msg_failure;
}
-
+
if (ad->reply_msg != conf_msg_failure2) {
_free(ad->reply_msg);
ad->reply_msg = conf_msg_failure2;
}
-
+
if (name)
_free(name);
}
@@ -398,7 +398,7 @@ static void chap_recv_response(struct chap_auth_data *ad, struct chap_hdr *hdr)
if (ad->name)
return;
-
+
ad->mschap_error = conf_msg_failure;
ad->reply_msg = conf_msg_failure2;
@@ -427,7 +427,7 @@ static void chap_recv_response(struct chap_auth_data *ad, struct chap_hdr *hdr)
ppp_auth_failed(ad->ppp, NULL);
return;
}
-
+
r = pwdb_check(&ad->ppp->ses, (pwdb_callback)auth_result, ad, name, PPP_CHAP, MSCHAP_V2, ad->id, ad->val, msg->peer_challenge, msg->reserved, msg->nt_hash, msg->flags, authenticator, &ad->mschap_error, &ad->reply_msg);
if (r == PWDB_WAIT) {
@@ -449,7 +449,7 @@ static void chap_recv_response(struct chap_auth_data *ad, struct chap_hdr *hdr)
ap_session_terminate(&ad->ppp->ses, TERM_AUTH_ERROR, 0);
else
ppp_auth_failed(ad->ppp, name);
-
+
_free(name);
if (ad->mschap_error != conf_msg_failure) {
@@ -508,7 +508,7 @@ static void des_encrypt(const uint8_t *input, const uint8_t *key, uint8_t *outpu
DES_set_key_checked(&cb, &ks);
memcpy(cb,input,8);
DES_ecb_encrypt(&cb,&res,&ks,DES_ENCRYPT);
- memcpy(output,res,8);
+ memcpy(output,res,8);
}
static int chap_check_response(struct chap_auth_data *ad, struct chap_response *msg, const char *name)
@@ -521,7 +521,7 @@ static int chap_check_response(struct chap_auth_data *ad, struct chap_response *
char *passwd;
char *u_passwd;
int i;
-
+
passwd = pwdb_get_passwd(&ad->ppp->ses, name);
if (!passwd) {
if (conf_ppp_verbose)
@@ -566,7 +566,7 @@ static void set_mppe_keys(struct chap_auth_data *ad, uint8_t *z_hash, uint8_t *n
uint8_t digest[20];
uint8_t send_key[20];
uint8_t recv_key[20];
-
+
uint8_t pad1[40] =
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -612,7 +612,7 @@ static void set_mppe_keys(struct chap_auth_data *ad, uint8_t *z_hash, uint8_t *n
.recv_key = recv_key,
.send_key = send_key,
};
-
+
//NtPasswordHashHash
MD4_Init(&md4_ctx);
MD4_Update(&md4_ctx, z_hash, 16);
@@ -652,7 +652,7 @@ static int chap_check(uint8_t *ptr)
static int chap_restart(struct ppp_t *ppp, struct auth_data_t *auth)
{
struct chap_auth_data *d = container_of(auth, typeof(*d), auth);
-
+
chap_send_challenge(d, 1);
return 0;
diff --git a/accel-pppd/auth/auth_pap.c b/accel-pppd/auth/auth_pap.c
index 909b115e..15154bf8 100644
--- a/accel-pppd/auth/auth_pap.c
+++ b/accel-pppd/auth/auth_pap.c
@@ -105,10 +105,10 @@ static int pap_start(struct ppp_t *ppp, struct auth_data_t *auth)
static int pap_finish(struct ppp_t *ppp, struct auth_data_t *auth)
{
struct pap_auth_data *d = container_of(auth, typeof(*d), auth);
-
+
if (d->timeout.tpd)
triton_timer_del(&d->timeout);
-
+
if (d->peer_id)
_free(d->peer_id);
@@ -147,10 +147,10 @@ static void pap_send_ack(struct pap_auth_data *p, int id)
msg->hdr.len = htons(HDR_LEN + 1 + sizeof(MSG_SUCCESSED) - 1);
msg->msg_len = sizeof(MSG_SUCCESSED) - 1;
memcpy(msg->msg, MSG_SUCCESSED, sizeof(MSG_SUCCESSED));
-
+
if (conf_ppp_verbose)
log_ppp_info2("send [PAP AuthAck id=%x \"%s\"]\n", id, MSG_SUCCESSED);
-
+
ppp_chan_send(p->ppp, msg, ntohs(msg->hdr.len) + 2);
}
@@ -164,10 +164,10 @@ static void pap_send_nak(struct pap_auth_data *p, int id)
msg->hdr.len = htons(HDR_LEN + 1 + sizeof(MSG_FAILED) - 1);
msg->msg_len = sizeof(MSG_FAILED) - 1;
memcpy(msg->msg, MSG_FAILED, sizeof(MSG_FAILED));
-
+
if (conf_ppp_verbose)
log_ppp_info2("send [PAP AuthNak id=%x \"%s\"]\n", id, MSG_FAILED);
-
+
ppp_chan_send(p->ppp, msg, ntohs(msg->hdr.len) + 2);
}
@@ -236,7 +236,7 @@ static int pap_recv_req(struct pap_auth_data *p, struct pap_hdr *hdr)
}
peer_id = _strndup((const char*)peer_id, peer_id_len);
-
+
if (conf_any_login) {
if (ppp_auth_succeeded(p->ppp, peer_id)) {
pap_send_nak(p, hdr->id);
@@ -293,17 +293,17 @@ static int pap_recv_req(struct pap_auth_data *p, struct pap_hdr *hdr)
_free(passwd);
return ret;
-
+
failed:
pap_send_nak(p, hdr->id);
if (p->started)
ap_session_terminate(&p->ppp->ses, TERM_AUTH_ERROR, 0);
else
ppp_auth_failed(p->ppp, peer_id);
-
+
_free(passwd);
_free(peer_id);
-
+
return -1;
}