static int get_uid_by_name(char *uname) { struct auth_profile *p=get_profile_by_name(uname); if (p==0) return S_NO_USER; else return p->uid; }
CMPIStatus get_profile_by_ref(const CMPIBroker *broker, const CMPIObjectPath *reference, const char **properties, CMPIInstance **_inst) { CMPIStatus s = {CMPI_RC_OK, NULL}; CMPIInstance *inst = NULL; const char *name = NULL; if (cu_get_str_path(reference, "InstanceID", &name) != CMPI_RC_OK) { cu_statusf(broker, &s, CMPI_RC_ERR_FAILED, "No InstanceID specified"); goto out; } s = get_profile_by_name(broker, reference, name, properties, &inst); if (s.rc != CMPI_RC_OK) goto out; s = cu_validate_ref(broker, reference, inst); if (s.rc != CMPI_RC_OK) goto out; *_inst = inst; out: return s; }
int auth_user(char *user,char *pass) { struct auth_profile *p=get_profile_by_name(user); if (p==0) return S_NO_USER; else if (!auth_strcmp(p->pass,pass)) return S_PASS_ERROR; else return p->uid; }
int auth_delete(char *user) { struct auth_profile *p=get_profile_by_name(user); if (p!=0) { map_delete(user); //struct auth_profile need to be free return p->uid; } return S_NO_USER; }