• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Get the UUID of the current user
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get the UUID of the current user


  • Subject: Re: Get the UUID of the current user
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Wed, 25 Jun 2008 14:08:31 +0200

Probably a private function.

Anyway, not really hard to implement:

#include <pwd.h>

mbr_user_name_to_uuid(const char *username, uuid_t uuid) {
struct passwd *info = getpwnam(username);
if (info)
	mbr_uid_to_uuid(info->pw_uid, uuid);
}


Le 25 juin 08 à 13:38, Yoann GINI a écrit :

A friend have teach me this options after send my mail, and in dsmbrutil.c I've found mbr_user_name_to_uuid() rather than mbr_uid_to_uuid(), but I haven't find mbr_user_name_to_uuid() in membership.h :-(

But I take note of that "look in Darwin's code" :-)


Le 25 juin 08 à 12:47, Michael Watson a écrit :

Jean-Daniel already provided an answer, but it's worth reminding people that the source code to many of the utilities that come with Mac OS X is available for dissection, including the Directory Services utilities:

http://www.opensource.apple.com/darwinsource/10.5/DSTools-109/dsmbrutil/dsmbrutil.c

If you can do it on the command-line with an open-source tool, you can extract the original code and use it directly. Your application will perform better, it will have fewer external tool version dependencies, and you can customize the data all you like without performing any additional shell tool parsing.


-- m-s

On 25 Jun, 2008, at 05:22, Yoann GINI wrote:

Hi all,

I look for get the UUID of the current user, the only way actually found is to run a NSTask with this command : "dsmemberutil getuuid -U `whoami`"... But it's not really a good solution for me.
Have you a idea for get the UUID without NSTask ?


Thanks in advance,
Yoann
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Get the UUID of the current user (From: Yoann GINI <email@hidden>)
 >Re: Get the UUID of the current user (From: Michael Watson <email@hidden>)
 >Re: Get the UUID of the current user (From: Yoann GINI <email@hidden>)

  • Prev by Date: Re: Get the UUID of the current user
  • Next by Date: Where can I get some examples of if() conditionals being used with string variables in Objective-C
  • Previous by thread: Re: Get the UUID of the current user
  • Next by thread: Where can I get some examples of if() conditionals being used with string variables in Objective-C
  • Index(es):
    • Date
    • Thread