Logo Search packages:      
Sourcecode: samba-doc-ja version File versions

BOOL winbindd_lookup_name_by_sid ( DOM_SID *  sid,
fstring  dom_name,
fstring  name,
enum SID_NAME_USE *  type 
)

Lookup a name in a domain from a sid.

Parameters:
sid Security ID you want to look up.
name On success, set to the name corresponding to sid.
dom_name On success, set to the 'domain name' corresponding to sid.
type On success, contains the type of name: alias, group or user.
Return values:
True if the name exists, in which case name and type are set, otherwise False.

Definition at line 254 of file winbindd_util.c.

References name_deadbeef, talloc_destroy(), and talloc_init_named().

{
      char *names;
      NTSTATUS result;
      TALLOC_CTX *mem_ctx;
      BOOL rv = False;
      struct winbindd_domain *domain;

      domain = find_domain_from_sid(sid);

      if (!domain) {
            DEBUG(1,("Can't find domain from sid\n"));
            return False;
      }

      /* Lookup name */

      if (!(mem_ctx = talloc_init_named("winbindd_lookup_name_by_sid")))
            return False;
        
      result = domain->methods->sid_to_name(domain, mem_ctx, sid, &names, type);

      /* Return name and type if successful */
        
      if ((rv = NT_STATUS_IS_OK(result))) {
            fstrcpy(dom_name, domain->name);
            fstrcpy(name, names);
      } else {
            *type = SID_NAME_UNKNOWN;
            fstrcpy(name, name_deadbeef);
      }
        
      talloc_destroy(mem_ctx);

      return rv;
}


Generated by  Doxygen 1.6.0   Back to index