Actually do magic, tested this time

pull/5/head
Michael Spang 15 years ago
parent 36e3ae8c9e
commit 34da813a37
  1. 25
      src/addclub.c
  2. 24
      src/addmember.c

@ -57,28 +57,29 @@ int addclub() {
deny("user %s already exists", userid);
snprintf(homedir, sizeof(homedir), "%s/%s", club_home, userid);
snprintf(acl_s, sizeof(acl_s), club_home_acl, userid);
ceo_krb5_init();
ceo_ldap_init();
ceo_kadm_init();
if (ceo_user_exists(userid))
deny("user %s already exists in LDAP", userid);
if ((id = ceo_new_uid(member_min_id, member_max_id)) <= 0)
fatal("no available uids in range [%d, %d]", member_min_id, member_max_id);
snprintf(acl_s, sizeof(acl_s), club_home_acl, id);
acl = acl_from_text(acl_s);
if (acl == NULL)
fatalpe("Unable to parse club_home_acl");
if (*club_home_acl) {
snprintf(dacl_s, sizeof(dacl_s), club_home_dacl, userid);
if (*club_home_dacl) {
snprintf(dacl_s, sizeof(dacl_s), club_home_dacl, id);
dacl = acl_from_text(dacl_s);
if (dacl == NULL)
fatalpe("Unable to parse club_home_dacl");
}
ceo_krb5_init();
ceo_ldap_init();
ceo_kadm_init();
if (ceo_user_exists(userid))
deny("user %s already exists in LDAP", userid);
if ((id = ceo_new_uid(member_min_id, member_max_id)) <= 0)
fatal("no available uids in range [%d, %d]", member_min_id, member_max_id);
krb_ok = ceo_del_princ(userid);
if (!krb_ok)

@ -62,18 +62,6 @@ int addmember() {
deny("user %s already exists", userid);
snprintf(homedir, sizeof(homedir), "%s/%s", member_home, userid);
snprintf(acl_s, sizeof(acl_s), club_home_acl, userid);
acl = acl_from_text(acl_s);
if (acl == NULL)
fatalpe("Unable to parse member_home_acl");
if (*member_home_acl) {
snprintf(dacl_s, sizeof(dacl_s), club_home_dacl, userid);
dacl = acl_from_text(dacl_s);
if (dacl == NULL)
fatalpe("Unable to parse member_home_dacl");
}
if (ceo_read_password(password, sizeof(password), use_stdin))
return 1;
@ -88,6 +76,18 @@ int addmember() {
if ((id = ceo_new_uid(member_min_id, member_max_id)) <= 0)
fatal("no available uids in range [%d, %d]", member_min_id, member_max_id);
snprintf(acl_s, sizeof(acl_s), club_home_acl, id);
acl = acl_from_text(acl_s);
if (acl == NULL)
fatalpe("Unable to parse member_home_acl");
if (*member_home_acl) {
snprintf(dacl_s, sizeof(dacl_s), club_home_dacl, id);
dacl = acl_from_text(dacl_s);
if (dacl == NULL)
fatalpe("Unable to parse member_home_dacl");
}
krb_ok = ceo_del_princ(userid);
krb_ok = krb_ok || ceo_add_princ(userid, password);
if (!krb_ok)

Loading…
Cancel
Save