summaryrefslogtreecommitdiff
path: root/accel-pppd/extra
diff options
context:
space:
mode:
authorVladislav Grishenko <themiron@mail.ru>2017-12-07 04:47:09 +0500
committerVladislav Grishenko <themiron@mail.ru>2017-12-07 04:50:04 +0500
commitd86db57252bd9837f5428ccb2a8a3fdcd6324cb5 (patch)
tree0c103c8ed4742b4bbb74fb573b89534133866848 /accel-pppd/extra
parent221358f2630ad56c980153443f152ca4c1abbbae (diff)
downloadaccel-ppp-d86db57252bd9837f5428ccb2a8a3fdcd6324cb5.tar.gz
accel-ppp-d86db57252bd9837f5428ccb2a8a3fdcd6324cb5.zip
chap-secrets: assume 4th field as pool name
Simplify previous commit, if 4th field isn't empty and doesn't start with reserved chars (*-!), assume it as pool name. Also, fix build warn without OPENSSL.
Diffstat (limited to 'accel-pppd/extra')
-rw-r--r--accel-pppd/extra/chap-secrets.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/accel-pppd/extra/chap-secrets.c b/accel-pppd/extra/chap-secrets.c
index 166a619..becb687 100644
--- a/accel-pppd/extra/chap-secrets.c
+++ b/accel-pppd/extra/chap-secrets.c
@@ -123,14 +123,16 @@ static struct cs_pd_t *create_pd(struct ap_session *ses, const char *username)
FILE *f;
char *buf;
char *ptr[5];
- int n, i;
+ int n;
struct cs_pd_t *pd;
+ struct in_addr in;
#ifdef CRYPTO_OPENSSL
char username_hash[EVP_MAX_MD_SIZE * 2 + 1];
uint8_t hash[EVP_MAX_MD_SIZE];
struct hash_chain *hc;
EVP_MD_CTX *md_ctx = NULL;
char c;
+ int i;
#endif
if (!conf_chap_secrets)
@@ -230,11 +232,11 @@ found:
}
pd->ip.addr = conf_gw_ip_address;
- if (n >= 3 && ptr[2][0] != '*') {
- if (strncmp(ptr[2], "pool=", 5) == 0)
- pd->pool = _strdup(ptr[2] + 5);
+ if (n >= 3 && !strchr("*-!", ptr[2][0])) {
+ if (inet_aton(ptr[2], &in))
+ pd->ip.peer_addr = in.s_addr;
else
- pd->ip.peer_addr = inet_addr(ptr[2]);
+ pd->pool = _strdup(ptr[2]);
}
pd->ip.mask = conf_netmask;
pd->ip.owner = &ipdb;