From b991d32e63b526ebbf1102bc6cb2af068afb4be4 Mon Sep 17 00:00:00 2001 From: Michael Spang Date: Tue, 15 Jan 2008 17:49:13 -0500 Subject: [PATCH 1/4] Fix magic --- src/addclub.c | 3 +++ src/addmember.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/addclub.c b/src/addclub.c index becc7dc..fb26587 100644 --- a/src/addclub.c +++ b/src/addclub.c @@ -45,6 +45,7 @@ int addclub() { int krb_ok, user_ok, group_ok, sudo_ok, home_ok, quota_ok; int id; char homedir[1024]; + char acl_s[1024], dacl_s[1024]; acl_t acl = NULL, dacl = NULL; logmsg("adding uid=%s cn=%s by %s", userid, name, user); @@ -56,12 +57,14 @@ 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); acl = acl_from_text(club_home_acl); if (acl == NULL) fatalpe("Unable to parse club_home_acl"); if (*club_home_acl) { + snprintf(dacl_s, sizeof(dacl_s), club_home_dacl, userid); dacl = acl_from_text(club_home_dacl); if (dacl == NULL) fatalpe("Unable to parse club_home_dacl"); diff --git a/src/addmember.c b/src/addmember.c index 16a2076..581bbb3 100644 --- a/src/addmember.c +++ b/src/addmember.c @@ -50,6 +50,7 @@ int addmember() { int krb_ok, user_ok, group_ok, home_ok, quota_ok; int id; char homedir[1024]; + char acl_s[1024], dacl_s[1024]; acl_t acl = NULL, dacl = NULL; logmsg("adding uid=%s cn=%s program=%s by %s", userid, name, program, user); @@ -61,12 +62,14 @@ 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(member_home_acl); 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(member_home_dacl); if (dacl == NULL) fatalpe("Unable to parse member_home_dacl"); From 36e3ae8c9e634f751f3ac7532a0f0ffca6d6a0bf Mon Sep 17 00:00:00 2001 From: Michael Spang Date: Tue, 15 Jan 2008 17:52:49 -0500 Subject: [PATCH 2/4] Fix magic, really --- src/addclub.c | 4 ++-- src/addmember.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/addclub.c b/src/addclub.c index fb26587..2069c2a 100644 --- a/src/addclub.c +++ b/src/addclub.c @@ -59,13 +59,13 @@ int addclub() { snprintf(homedir, sizeof(homedir), "%s/%s", club_home, userid); snprintf(acl_s, sizeof(acl_s), club_home_acl, userid); - acl = acl_from_text(club_home_acl); + 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); - dacl = acl_from_text(club_home_dacl); + dacl = acl_from_text(dacl_s); if (dacl == NULL) fatalpe("Unable to parse club_home_dacl"); } diff --git a/src/addmember.c b/src/addmember.c index 581bbb3..ea4d1eb 100644 --- a/src/addmember.c +++ b/src/addmember.c @@ -64,13 +64,13 @@ int addmember() { snprintf(homedir, sizeof(homedir), "%s/%s", member_home, userid); snprintf(acl_s, sizeof(acl_s), club_home_acl, userid); - acl = acl_from_text(member_home_acl); + 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(member_home_dacl); + dacl = acl_from_text(dacl_s); if (dacl == NULL) fatalpe("Unable to parse member_home_dacl"); } From 34da813a3721f6d3f176aad893359d007710cf3b Mon Sep 17 00:00:00 2001 From: Michael Spang Date: Tue, 15 Jan 2008 18:20:33 -0500 Subject: [PATCH 3/4] Actually do magic, tested this time --- src/addclub.c | 27 ++++++++++++++------------- src/addmember.c | 24 ++++++++++++------------ 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/addclub.c b/src/addclub.c index 2069c2a..37da57d 100644 --- a/src/addclub.c +++ b/src/addclub.c @@ -57,19 +57,6 @@ 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); - - 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); - 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(); @@ -80,6 +67,20 @@ int addclub() { 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_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"); + } + + krb_ok = ceo_del_princ(userid); if (!krb_ok) logmsg("successfully cleared principal for %s", userid); diff --git a/src/addmember.c b/src/addmember.c index ea4d1eb..f5d4051 100644 --- a/src/addmember.c +++ b/src/addmember.c @@ -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) From d46915dbeec7c0ef31e8a392096acb42c12340ea Mon Sep 17 00:00:00 2001 From: Michael Spang Date: Fri, 18 Jan 2008 23:29:12 -0500 Subject: [PATCH 4/4] Fix use of club settings in addmember --- src/addmember.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/addmember.c b/src/addmember.c index f5d4051..f43507a 100644 --- a/src/addmember.c +++ b/src/addmember.c @@ -76,14 +76,14 @@ 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); + snprintf(acl_s, sizeof(acl_s), member_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); + snprintf(dacl_s, sizeof(dacl_s), member_home_dacl, id); dacl = acl_from_text(dacl_s); if (dacl == NULL) fatalpe("Unable to parse member_home_dacl");