Lines Matching defs:u

102 #define	USERF		'u'
187 struct usr *u; /* ptr to the owner (usr) of this event */
384 static int verify_user_cred(struct usr *u);
405 static void clean_out_atjobs(struct usr *u);
406 static void clean_out_ctab(struct usr *u);
407 static void clean_out_user(struct usr *u);
433 struct usr *u;
519 u = uhead;
520 while (u != NULL) {
521 rm_ctevents(u);
522 e = u->atevents;
529 u->atevents = NULL;
530 u = u->nextusr;
635 (next_event->u)->ctid)) {
651 e = (next_event->u)->atevents;
655 (e->u)->atevents = e->link;
837 struct usr *u;
839 u = xcalloc(1, sizeof (struct usr));
840 u->name = xstrdup(name);
842 u->ctexists = TRUE;
843 u->ctid = ecid++;
845 u->ctexists = FALSE;
846 u->ctid = 0;
848 u->uid = (uid_t)-1;
849 u->gid = (uid_t)-1;
850 u->nextusr = uhead;
851 uhead = u;
852 return (u);
858 struct usr *u;
861 u = create_ulist(name, CRONEVENT);
862 readcron(u, 0);
864 if ((u = find_usr(name)) == NULL) {
865 u = create_ulist(name, CRONEVENT);
866 readcron(u, 0);
868 u->ctexists = TRUE;
869 rm_ctevents(u);
870 el_remove(u->ctid, 0);
871 readcron(u, 0);
879 struct usr *u;
882 u = create_ulist(name, ATEVENT);
883 add_atevent(u, name, tim, jobtype);
885 if ((u = find_usr(name)) == NULL) {
886 u = create_ulist(name, ATEVENT);
887 add_atevent(u, name, tim, jobtype);
889 update_atevent(u, name, tim, jobtype);
899 struct usr *u;
944 if ((u = find_usr(name)) == NULL) {
948 u = create_ulist(name, CRONEVENT);
949 u->home = xmalloc(strlen(pw->pw_dir) + 1);
950 (void) strcpy(u->home, pw->pw_dir);
951 u->uid = pw->pw_uid;
952 u->gid = pw->pw_gid;
953 readcron(u, reftime);
955 u->uid = pw->pw_uid;
956 u->gid = pw->pw_gid;
957 if (u->home != NULL) {
958 if (strcmp(u->home, pw->pw_dir) != 0) {
959 free(u->home);
960 u->home = xmalloc(strlen(pw->pw_dir) + 1);
961 (void) strcpy(u->home, pw->pw_dir);
964 u->home = xmalloc(strlen(pw->pw_dir) + 1);
965 (void) strcpy(u->home, pw->pw_dir);
967 u->ctexists = TRUE;
968 if (u->ctid == 0) {
971 u->name);
974 u->ctid = ecid++;
975 u->ctevents = NULL;
976 readcron(u, reftime);
980 (void) fprintf(stderr, "%s has revised his crontab\n", u->name);
982 rm_ctevents(u);
983 el_remove(u->ctid, 0);
984 readcron(u, reftime);
996 struct usr *u;
1047 if ((u = find_usr(pw->pw_name)) == NULL) {
1052 u = create_ulist(pw->pw_name, ATEVENT);
1053 u->home = xstrdup(pw->pw_dir);
1054 u->uid = pw->pw_uid;
1055 u->gid = pw->pw_gid;
1056 add_atevent(u, name, tim, jobtype);
1058 u->uid = pw->pw_uid;
1059 u->gid = pw->pw_gid;
1060 free(u->home);
1061 u->home = xstrdup(pw->pw_dir);
1062 update_atevent(u, name, tim, jobtype);
1067 add_atevent(struct usr *u, char *job, time_t tim, int jobtype)
1075 e->u = u;
1076 e->link = u->atevents;
1077 u->atevents = e;
1086 u->name, e->cmd, e->time);
1094 update_atevent(struct usr *u, char *name, time_t tim, int jobtype)
1098 e = u->atevents;
1110 u->name, name);
1112 add_atevent(u, name, tim, jobtype);
1120 readcron(struct usr *u, time_t reftime)
1123 * readcron reads in a crontab file for a user (u). The list of
1124 * events for user u is built, and u->events is made to point to
1143 CRONDIR, u->name) >= sizeof (namebuf)) {
1148 pname = u->name;
1151 mail(u->name, NOREAD, ERR_UNIXERR);
1259 e->u = u;
1261 e->link = u->ctevents;
1262 u->ctevents = e;
1266 switch (el_add(e, e->time, u->ctid)) {
1281 cte_sendmail(u->name); /* mail errors if any to user */
2043 free_if_unused(struct usr *u)
2053 if (!u->ctexists && u->atevents == NULL &&
2054 u->cruncnt == 0 && u->aruncnt == 0) {
2056 (void) fprintf(stderr, "%s removed from usr list\n", u->name);
2059 cur != u;
2067 uhead = u->nextusr;
2069 prev->nextusr = u->nextusr;
2070 free(u->name);
2071 free(u->home);
2072 free(u);
2081 struct usr *u;
2083 if ((u = find_usr(usrname)) == NULL)
2085 e = u->atevents;
2092 u->atevents = e->link;
2105 free_if_unused(u);
2112 struct usr *u;
2114 if ((u = find_usr(name)) == NULL)
2116 rm_ctevents(u);
2117 el_remove(u->ctid, 0);
2118 u->ctid = 0;
2119 u->ctexists = 0;
2121 free_if_unused(u);
2125 rm_ctevents(struct usr *u)
2136 (next_event->u == u)) {
2139 e2 = u->ctevents;
2156 u->ctevents = NULL;
2163 struct usr *u;
2165 u = uhead;
2166 while (u != NULL) {
2167 if (strcmp(u->name, uname) == 0)
2168 return (u);
2169 u = u->nextusr;
2239 mail((e->u)->name, BADJOBOPEN, ERR_CANTEXECAT);
2283 (next_event->u)->ctid)) {
2323 (e->u)->aruncnt++;
2325 (e->u)->cruncnt++;
2326 rp->rusr = (e->u);
2344 mail((e->u)->name, BADJOBOPEN, ERR_CANTEXECCRON);
2356 mail((e->u)->name, BADJOBOPEN, ERR_CANTEXECCRON);
2373 !inproj(e->u->name, pproj->pj_name,
2376 mail((e->u)->name, BADPROJID, ERR_CANTEXECAT);
2387 " for user %s", errno, e->cmd, e->u->name);
2396 r = set_user_cred(e->u, pproj);
2398 msg("user (%s) account is expired", e->u->name);
2399 audit_cron_user_acct_expired(e->u->name);
2400 clean_out_user(e->u);
2404 msg("user (%s) password has expired", e->u->name);
2405 audit_cron_user_acct_expired(e->u->name);
2406 clean_out_user(e->u);
2410 msg("bad user (%s)", e->u->name);
2411 audit_cron_bad_user(e->u->name);
2412 clean_out_user(e->u);
2421 if (verify_user_cred(e->u) != VUC_OK ||
2422 setgid(e->u->gid) == -1 ||
2423 initgroups(e->u->name, e->u->gid) == -1) {
2425 e->u->name, e->u->name);
2426 audit_cron_bad_user(e->u->name);
2427 clean_out_user(e->u);
2431 if ((e->u)->uid == 0) { /* set default path */
2439 r = audit_cron_session(e->u->name, NULL,
2440 e->u->uid, e->u->gid, at_cmdfile);
2443 r = audit_cron_session(e->u->name, CRONDIR,
2444 e->u->uid, e->u->gid, NULL);
2448 e->cmd, e->u->name);
2454 if (setuid(e->u->uid) == -1) {
2455 msg("setuid failed (%s)", e->u->name);
2456 clean_out_user(e->u);
2464 mail((e->u)->name, MALLOCERR,
2470 mail((e->u)->name, NOSTDIN,
2479 mail((e->u)->name, NOSTDIN, ERR_CANTEXECCRON);
2517 home = (e->u)->home;
2520 (void) strlcat(logname, (e->u)->name, sizeof (logname));
2524 mail((e->u)->name, bufs.error,
2538 if ((e->u)->uid != 0)
2566 mail((e->u)->name, bufs.error,
2868 (next_event->u)->ctid)) {
3023 event->u->name ? event->u->name : "unknown",
3041 (void) printf("%c %s %u %c %s",
3063 (next_event->u)->ctid)) {
3075 add_atevent(next_event->u, next_event->cmd, nt, next_event->etype);
3194 verify_user_cred(struct usr *u)
3219 if ((pw = getpwnam(u->name)) == NULL)
3221 if (u->home != NULL) {
3222 if (strcmp(u->home, pw->pw_dir) != 0) {
3223 free(u->home);
3224 u->home = xmalloc(strlen(pw->pw_dir) + 1);
3225 (void) strcpy(u->home, pw->pw_dir);
3228 u->home = xmalloc(strlen(pw->pw_dir) + 1);
3229 (void) strcpy(u->home, pw->pw_dir);
3231 if (u->uid != pw->pw_uid)
3232 u->uid = pw->pw_uid;
3233 if (u->gid != pw->pw_gid)
3234 u->gid = pw->pw_gid;
3256 "u->gid = %d\n", pw->pw_gid, u->gid);
3259 retval = (u->gid == pw->pw_gid) ? VUC_OK : VUC_NOTINGROUP;
3268 if (UsrGrps[i] == u->gid) {
3287 set_user_cred(const struct usr *u, struct project *pproj)
3292 if ((r = pam_start(progname, u->name, &pam_conv, &pamh))
3336 clean_out_user(struct usr *u)
3338 if (next_event->u == u) {
3342 clean_out_ctab(u);
3343 clean_out_atjobs(u);
3344 free_if_unused(u);
3348 clean_out_atjobs(struct usr *u)
3352 for (pv = NULL, ev = u->atevents;
3369 u->atevents = NULL;
3373 clean_out_ctab(struct usr *u)
3375 rm_ctevents(u);
3376 el_remove(u->ctid, 0);
3377 u->ctid = 0;
3378 u->ctexists = 0;
3395 if (audit_cron_create_anc_file(e->u->name,
3397 e->u->name, e->u->uid) == -1) {
3407 (void) audit_cron_delete_anc_file(e->u->name,
3419 e->u->name, e->u->uid) == -1) {
3440 struct usr *u = uhead;
3447 if (u->ctexists && u->ctevents != NULL) {
3448 e = u->ctevents;
3459 if (u->atevents != NULL) {
3460 e = u->atevents;
3471 if ((u = u->nextusr) == NULL)