[package] update ppp to v2.4.4 (#5102)
[openwrt.git] / package / ppp / patches / 106-debian_stripMSdomain.patch
1 diff -Naur ppp-2.4.4.orig/pppd/chap-new.c ppp-2.4.4/pppd/chap-new.c
2 --- ppp-2.4.4.orig/pppd/chap-new.c      2005-07-13 06:41:58.000000000 -0400
3 +++ ppp-2.4.4/pppd/chap-new.c   2009-05-07 16:18:37.000000000 -0400
4 @@ -57,6 +57,7 @@
5  int chap_timeout_time = 3;
6  int chap_max_transmits = 10;
7  int chap_rechallenge_time = 0;
8 +int chapms_strip_domain = 0;
9  
10  /*
11   * Command-line options.
12 @@ -68,6 +69,8 @@
13           "Set max #xmits for challenge", OPT_PRIO },
14         { "chap-interval", o_int, &chap_rechallenge_time,
15           "Set interval for rechallenge", OPT_PRIO },
16 +       { "chapms-strip-domain", o_bool, &chapms_strip_domain,
17 +         "Strip the domain prefix before the Username", 1 },
18         { NULL }
19  };
20  
21 @@ -335,6 +338,14 @@
22                         /* Null terminate and clean remote name. */
23                         slprintf(rname, sizeof(rname), "%.*v", len, name);
24                         name = rname;
25 +
26 +                       /* strip the MS domain name */
27 +                       if (chapms_strip_domain && strrchr(rname, '\\')) {
28 +                               char tmp[MAXNAMELEN+1];
29 +
30 +                               strcpy(tmp, strrchr(rname, '\\') + 1);
31 +                               strcpy(rname, tmp);
32 +                       }
33                 }
34  
35                 if (chap_verify_hook)
36 diff -Naur ppp-2.4.4.orig/pppd/chap-new.c ppp-2.4.4/pppd/chap-new.c
37 --- ppp-2.4.4.orig/pppd/chap-new.c      2005-07-13 06:41:58.000000000 -0400
38 +++ ppp-2.4.4/pppd/chap-new.c   2009-05-07 16:18:37.000000000 -0400
39 @@ -57,6 +57,7 @@
40  int chap_timeout_time = 3;
41  int chap_max_transmits = 10;
42  int chap_rechallenge_time = 0;
43 +int chapms_strip_domain = 0;
44  
45  /*
46   * Command-line options.
47 @@ -68,6 +69,8 @@
48           "Set max #xmits for challenge", OPT_PRIO },
49         { "chap-interval", o_int, &chap_rechallenge_time,
50           "Set interval for rechallenge", OPT_PRIO },
51 +       { "chapms-strip-domain", o_bool, &chapms_strip_domain,
52 +         "Strip the domain prefix before the Username", 1 },
53         { NULL }
54  };
55  
56 @@ -335,6 +338,14 @@
57                         /* Null terminate and clean remote name. */
58                         slprintf(rname, sizeof(rname), "%.*v", len, name);
59                         name = rname;
60 +
61 +                       /* strip the MS domain name */
62 +                       if (chapms_strip_domain && strrchr(rname, '\\')) {
63 +                               char tmp[MAXNAMELEN+1];
64 +
65 +                               strcpy(tmp, strrchr(rname, '\\') + 1);
66 +                               strcpy(rname, tmp);
67 +                       }
68                 }
69  
70                 if (chap_verify_hook)