From 6103878d4751a16075759091b73cf61d97687c25 Mon Sep 17 00:00:00 2001 From: Tijs Van Buggenhout Date: Mon, 4 Jan 2021 23:57:13 +0100 Subject: [PATCH] pppd: (Re)use chap_find_digest in chap_auth_peer Code duplication. Signed-off-by: Tijs Van Buggenhout --- pppd/chap-new.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pppd/chap-new.c b/pppd/chap-new.c index 15206f6..10e4507 100644 --- a/pppd/chap-new.c +++ b/pppd/chap-new.c @@ -222,9 +222,8 @@ chap_auth_peer(int unit, char *our_name, int digest_code) error("CHAP: peer authentication already started!"); return; } - for (dp = chap_digests; dp != NULL; dp = dp->next) - if (dp->code == digest_code) - break; + + dp = chap_find_digest(digest_code); if (dp == NULL) fatal("CHAP digest 0x%x requested but not available", digest_code); -- 2.39.2