Michael Van Canneyt wrote:
> 
> On Sun, 7 Jan 2007, R. B. wrote:
> 
>> Hello,
>>
>> I almost finished my first application that I build using fpc/lazarus. It is 
>> an IDE for an AI language and I have to greatly admire all those who made 
>> fpc (big thumb up despite I haven't got enough time to check out the source 
>> specially the three-pass part) and lazarus possible. I couldn't believe how 
>> easy it was to make a binary for linux and the other for win using the same 
>> source). Now it's easier for me to say that it's quite possible that I will 
>> not go back to C/C++ again. Many many thanks to you all and hopefully I will 
>> give a hand when I get enough experience.
>> My second project that I plan to build with fpc/lazarus is a Package 
>> Manager. I have'nt started yet but already have a question in mind: how to 
>> make the program itself sure that the user is root? OK, if the uid is not 
>> zero then it prompts for the root's password, then what? How to see that the 
>> passwd is the root's? Any ideas?
> 
> 2 options:
> - use getpwnam from libc  (for root, getpwuid is easier)
> - Encrypt password and compare with the encrypted password found in 
> /etc/shadow or
>   /etc/passwd

The file /etc/shadow is not readable by users, because that's why it is
separate from /etc/passwd :-).

Micha

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to