[Mono-dev] UnixUserInfo issues in OpenBSD

pablosantosluac at terra.es pablosantosluac at terra.es
Wed Oct 13 10:38:28 EDT 2010


Reading your C code I see once more how powerful C# is... :P

This is what I get:

$ ./a.out tester
# checking return value 1; errno=13
User tester:
         pw_name=ÇEðÄ
À
 ¢
          pw_uid=752427404
          pw_gid=-809631572
        pw_gecos=(null)
          pw_dir=(null)
        pw_shell=UåSj


$ ./a.out pablo
# checking return value 1; errno=13
User pablo:
         pw_name=ÇEðÄ
À
 ¢
          pw_uid=656871820
          pw_gid=-809738964
        pw_gecos=(null)
          pw_dir=(null)
        pw_shell=UåSj


We're getting an errno in both cases...

OpenBSD is a cool beast! :P



On 13/10/2010 15:29, Jonathan Pryor wrote:
> I have no idea why it's failing.  Sorry.
> 
> What I can do is send you a C program which closely mirrors what
> Mono.Unix is doing.  Could you compile and run it, and see if it fails
> in the same ways?  The program source is attached.
> 
>  - Jon
> 
> On Wed, 2010-10-13 at 10:43 +0200, pablosantosluac at terra.es wrote:
>> Hi all,
>>
>> The following simple program fails on OpenBSD:
>>
>> using System;
>> using Mono.Unix;
>>
>> public class Info
>> {
>>
>>         public static void Main()
>>         {
>>                 Console.WriteLine(Environment.UserName);
>>                 Console.WriteLine(new
>> UnixUserInfo(Environment.UserName).UserName);
>>                 Console.WriteLine(UnixUserInfo.GetRealUser().UserName);
>>         }
>> }
>>
>>
>> Environment.UserName retrieves the right user.
>>
>>
>> The two next calls fail saying "invalid param":
>>
>>   Console.WriteLine(new UnixUserInfo(Environment.UserName).UserName);
>>   Console.WriteLine(UnixUserInfo.GetRealUser().UserName);
>>
>> It seems the problem is the return of the native method getpwuid_r, that
>> returns 1 instead of 0.
>>
>> I tried running as root to (suspected it could be a permissions issue)
>> but I get the same result.
>>
>> I thought it could be related to an old issue with UnixGroupInfo which
>> fails if the groups are incorrectly defined (have unexisting users) but
>> I think this time my config files are correctly set... :O
>>
>> Thanks,
>>
>> pablo
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 



More information about the Mono-devel-list mailing list