[4997] in Moira
Re: Don't output hesiod pobox entries for users with no pobox
daemon@ATHENA.MIT.EDU (Jonathon Weiss)
Mon Mar 5 18:29:35 2007
Message-Id: <200703052329.l25NTRrh015649@vorpal-blade.mit.edu>
From: Jonathon Weiss <jweiss@MIT.EDU>
To: Garry Zacheiss <zacheiss@MIT.EDU>
cc: moiradev@MIT.EDU
In-reply-to: Your message of "Mon, 05 Mar 2007 17:25:32 EST."
<200703052225.l25MPWXb025319@brad-majors.mit.edu>
Date: Mon, 05 Mar 2007 18:29:27 -0500
yay
Jonathon
> This patch comes by way of a question I fielded for jdreed last week
> sometime.
>
> Currently, if you delete a user's pobox, their potype in the users table
> gets set to 'NONE' but their {box_id, pop_id, imap_id} remain what they
> used to be; that's probably correct, because in the IMAP case they don't
> have bits to delete the filesys corresponding to their IMAP PO.
> However, it results in this confusing behavior:
>
> [zacheiss@brad-majors] ~$ chpobox register
> User register has no pobox.
> [zacheiss@brad-majors] ~$ hes register pobox
> POP PO10.MIT.EDU register
>
> This patch removes that hesiod entry.
>
> Garry
>
> Index: hesiod.pc
> ===================================================================
> RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/gen/hesiod.pc,v
> retrieving revision 1.18
> diff -u -r1.18 hesiod.pc
> --- hesiod.pc 30 Nov 2000 23:27:37 -0000 1.18
> +++ hesiod.pc 27 Feb 2007 22:03:31 -0000
> @@ -201,7 +201,7 @@
> char login[USERS_LOGIN_SIZE], shell[USERS_SHELL_SIZE];
> char fullname[USERS_FULLNAME_SIZE], oa[USERS_OFFICE_ADDR_SIZE];
> char op[USERS_OFFICE_PHONE_SIZE], hp[USERS_HOME_PHONE_SIZE];
> - char nn[USERS_NICKNAME_SIZE];
> + char nn[USERS_NICKNAME_SIZE], potype[USERS_POTYPE_SIZE];
> int uid, id, pid, iid, mid, status;
> EXEC SQL END DECLARE SECTION;
>
> @@ -237,7 +237,7 @@
> users = create_hash(12001);
> EXEC SQL DECLARE u_cursor CURSOR FOR
> SELECT login, unix_uid, shell, fullname, nickname, office_addr,
> - office_phone, home_phone, users_id, pop_id, imap_id, status
> + office_phone, home_phone, users_id, potype, pop_id, imap_id, status
> FROM users
> WHERE status = 1 OR status = 2 OR status = 5 OR status = 6
> ORDER BY users_id;
> @@ -245,7 +245,7 @@
> while (1)
> {
> EXEC SQL FETCH u_cursor INTO :login, :uid, :shell, :fullname, :nn,
> - :oa, :op, :hp, :id, :pid, :iid, :status;
> + :oa, :op, :hp, :id, :potype, :pid, :iid, :status;
> if (sqlca.sqlcode)
> break;
> strtrim(login);
> @@ -255,6 +255,7 @@
> dequote(op);
> dequote(hp);
> dequote(shell);
> + dequote(potype);
> u = malloc(sizeof(struct user));
> strcpy(u->name, login);
> u->lists = NULL;
> @@ -275,7 +276,8 @@
> pid = mid;
> }
>
> - if (pid != 0 && (mach = hash_lookup(machines, pid)))
> + if ((strcmp(potype, "NONE") != 0) && pid != 0 &&
> + (mach = hash_lookup(machines, pid)))
> {
> fprintf(bout, "%s.pobox\t%s %s \"POP %s %s\"\n",
> login, HCLASS, HTYPE, mach, login);