/[lwip]/lwip/src/netif/ppp/ppp.c
ViewVC logotype

Diff of /lwip/src/netif/ppp/ppp.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by marcbou, Thu Jun 19 11:31:25 2003 UTC revision 1.4.2.1 by marcbou, Fri Jun 27 19:35:11 2003 UTC
# Line 290  void pppInit(void) Line 290  void pppInit(void)
290            
291          memset(&ppp_settings, 0, sizeof(ppp_settings));          memset(&ppp_settings, 0, sizeof(ppp_settings));
292          ppp_settings.usepeerdns = 1;          ppp_settings.usepeerdns = 1;
293          ppp_settings.refuse_chap = (CHAP_SUPPORT == 0);          pppSetAuth(PPPAUTHTYPE_NONE, NULL, NULL);
294    
295          magicInit();          magicInit();
296    
# Line 313  void pppInit(void) Line 313  void pppInit(void)
313  #endif  #endif
314  }  }
315    
316  void pppSetAuth(const char *user, const char *passwd)  void pppSetAuth(enum pppAuthType authType, const char *user, const char *passwd)
317  {  {
318          if(user) {      switch(authType) {
319                  strncpy(ppp_settings.user, user, sizeof(ppp_settings.user)-1);          case PPPAUTHTYPE_NONE:
320                  ppp_settings.user[sizeof(ppp_settings.user)-1] = '\0';          default:
321          } else  #ifdef LWIP_PPP_STRICT_PAP_REJECT
322                  ppp_settings.user[0] = '\0';              ppp_settings.refuse_pap = 1;
323    #else
324          if(passwd) {              /* some providers request pap and accept an empty login/pw */
325                  strncpy(ppp_settings.passwd, passwd, sizeof(ppp_settings.passwd)-1);              ppp_settings.refuse_pap = 0;
326                  ppp_settings.passwd[sizeof(ppp_settings.passwd)-1] = '\0';  #endif
327          } else              ppp_settings.refuse_chap = 1;
328                  ppp_settings.passwd[0] = '\0';              break;
329            case PPPAUTHTYPE_PAP:
330                ppp_settings.refuse_pap = 0;
331                ppp_settings.refuse_chap = 1;
332                break;
333            case PPPAUTHTYPE_CHAP:
334                ppp_settings.refuse_pap = 1;
335                ppp_settings.refuse_chap = 0;
336                break;
337        }
338    
339        if(user) {
340            strncpy(ppp_settings.user, user, sizeof(ppp_settings.user)-1);
341            ppp_settings.user[sizeof(ppp_settings.user)-1] = '\0';
342        } else
343            ppp_settings.user[0] = '\0';
344    
345        if(passwd) {
346            strncpy(ppp_settings.passwd, passwd, sizeof(ppp_settings.passwd)-1);
347            ppp_settings.passwd[sizeof(ppp_settings.passwd)-1] = '\0';
348        } else
349            ppp_settings.passwd[0] = '\0';
350  }  }
351    
352  /* Open a new PPP connection using the given I/O device.  /* Open a new PPP connection using the given I/O device.

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.4.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26