void hub_schedule_destroy_user(struct hub_info* hub, struct hub_user* user) { struct event_data post; memset(&post, 0, sizeof(post)); post.id = UHUB_EVENT_USER_DESTROY; post.ptr = user; event_queue_post(hub->queue, &post); if (user->id.sid) { sid_free(hub->users->sids, user->id.sid); } }
/* * Given a well-known name structure, generate a binary-format SID. * It's a bit perverse that we must take a text-format SID and turn it into * a binary-format SID, only to have the caller probably turn it back into * text format, but SIDs are carried across LDAP in binary format. */ static directory_error_t sid_dav(directory_values_rpc *lvals, const wksids_table_t *wksid) { char *text_sid; sid_t *sid; directory_error_t de; if (wksid->sidprefix == NULL) { RDLOCK_CONFIG(); (void) asprintf(&text_sid, "%s-%d", _idmapdstate.cfg->pgcfg.machine_sid, wksid->rid); UNLOCK_CONFIG(); } else { (void) asprintf(&text_sid, "%s-%d", wksid->sidprefix, wksid->rid); } if (text_sid == NULL) goto nomem; sid = sid_fromstr(text_sid); free(text_sid); if (sid == NULL) goto nomem; sid_to_le(sid); de = bin_list_dav(lvals, sid, 1, sid_len(sid)); sid_free(sid); return (de); nomem: return (directory_error("ENOMEM.sid_dav", "No memory allocating SID for user lookup", NULL)); }