summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrian <brian@cvs.openbsd.org>2002-07-02 00:48:31 +0000
committerbrian <brian@cvs.openbsd.org>2002-07-02 00:48:31 +0000
commit79416151d56628dd88c759bc02fa5bdbf5ce2ae4 (patch)
tree83fd41144e571844ffb3653706394878ab7665e3
parent0059a10758b7f378c18ca95a047b7a93b3f26cd5 (diff)
Don't trust the MPPE key lengths passed back from the RADIUS server.
Instead, use the correct values based on the number of bits actually negotiated.
-rw-r--r--usr.sbin/ppp/ppp/mppe.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/ppp/ppp/mppe.c b/usr.sbin/ppp/ppp/mppe.c
index 3f599ad957f..af76df16e7d 100644
--- a/usr.sbin/ppp/ppp/mppe.c
+++ b/usr.sbin/ppp/ppp/mppe.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: mppe.c,v 1.15 2002/07/01 11:14:35 brian Exp $
+ * $OpenBSD: mppe.c,v 1.16 2002/07/02 00:48:30 brian Exp $
*/
#include <sys/param.h>
@@ -691,7 +691,8 @@ MPPEInitInput(struct bundle *bundle, struct fsm_opt *o)
#ifndef NORADIUS
if (*bundle->radius.cfg.file && bundle->radius.mppe.recvkey) {
- mip->keylen = bundle->radius.mppe.recvkeylen;
+ if (mip->keylen > bundle->radius.mppe.recvkeylen)
+ mip->keylen = bundle->radius.mppe.recvkeylen;
if (mip->keylen > sizeof mip->mastkey)
mip->keylen = sizeof mip->mastkey;
memcpy(mip->mastkey, bundle->radius.mppe.recvkey, mip->keylen);
@@ -746,7 +747,8 @@ MPPEInitOutput(struct bundle *bundle, struct fsm_opt *o)
#ifndef NORADIUS
if (*bundle->radius.cfg.file && bundle->radius.mppe.sendkey) {
- mop->keylen = bundle->radius.mppe.sendkeylen;
+ if (mop->keylen > bundle->radius.mppe.sendkeylen)
+ mop->keylen = bundle->radius.mppe.sendkeylen;
if (mop->keylen > sizeof mop->mastkey)
mop->keylen = sizeof mop->mastkey;
memcpy(mop->mastkey, bundle->radius.mppe.sendkey, mop->keylen);