[En-Nut-Discussion] Ppp user/pass

Lorenzo Lombardo lorenzo.lombardo at satbn.com
Wed Sep 6 11:05:41 CEST 2006


There's a little error, change

pppStr = (char *) malloc(strlen(pppCom) + strlen(pppUser) + 
strlen(pppPassword) + 9);

with

pppStr = (char *) malloc(strlen(pppCom) + strlen(pppUser) + 
strlen(pppPassword) + 7);

because the null char at the end of the string we are going to make is one.

----- Original Message ----- 
From: "Lorenzo Lombardo" <lorenzo.lombardo at satbn.com>
To: "Ethernut User Chat (English)" <en-nut-discussion at egnite.de>
Sent: Wednesday, September 06, 2006 11:00 AM
Subject: Re: [En-Nut-Discussion] Ppp user/pass


>I don't know what PPPCOM stands for, so I assume that it is a string as 
>well.
>
> #include <stdlib.h>
> #include <string.h>
> char *pppStr, pppCom[16], pppUser[16], pppPassword[16];
>
> <code>
>
> //we are going to make the mem space for the string that is the length of 
> every string plus 1 (because of the null char at the end of them) plus 6 
> (because "ppp:" and the two slashes are 6 chars)
> pppStr = (char *) malloc(strlen(pppCom) + strlen(pppUser) + 
> strlen(pppPassword) + 9);
> //composing the string
> sprintf(pppStr, "ppp:%s/%s/%s", pppCom, pppUser, pppPassword);
> //now the string is ready to be passed the the _open function
> _open(pppStr, _O_RDWR | _O_BINARY))
> //it's important that if you don't use pppStr anymore you have to free the 
> mem space so...
> free(pppStr);
>
> <code>
>
> If pppCom isn't a string then you have to change the "strlen(pppCom)" 
> thing with the size of the variable you're using and change the proper 
> argument in the sprintf function.
> Hope this helps,
>    Lorenzo
>
> ----- Original Message ----- 
> From: "Szemző András" <saam at kometa.hu>
> To: "'Ethernut User Chat (English)'" <en-nut-discussion at egnite.de>
> Sent: Tuesday, September 05, 2006 8:21 PM
> Subject: [En-Nut-Discussion] Ppp user/pass
>
>
>> Hi all,
>>
>>
>> Sorry for a stupid question, but how can I pass PPPUSER and PPPPASS to 
>> the
>> _open fuction.
>>
>> In the example there is a
>>
>> #define PPPUSER "user"
>> #define PPPPASS "pass"
>>
>> _open("ppp:" PPPCOM "/" PPPUSER "/" PPPPASS, _O_RDWR | _O_BINARY))
>>
>>
>> I would like to use not static user name and password.
>> I mean something
>>
>> unsgined char PPPUSER[16];
>>
>> But I get a lot of errors.
>>
>>
>>
>> Best Regards,
>> Andras
>>
>>
>> _______________________________________________
>> En-Nut-Discussion mailing list
>> En-Nut-Discussion at egnite.de
>> http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
>>
>>
>>
>> -- 
>> No virus found in this incoming message.
>> Checked by AVG Free Edition.
>> Version: 7.1.405 / Virus Database: 268.11.7/437 - Release Date: 
>> 04/09/2006
>>
>>
>
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
>
>
>
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.405 / Virus Database: 268.11.7/438 - Release Date: 05/09/2006
>
> 




More information about the En-Nut-Discussion mailing list