WHERE u.unix_uid = :argv[0] AND u.users_id != 0;
}
- if (sqlca.sqlerrd[2] != 1 || id != cl->users_id)
+ if (sqlca.sqlcode == SQL_NO_MATCH)
+ return(MR_NO_MATCH); /* ought to be MR_USER, but this is what
+ gual returns, so we have to be consistent */
+ else if (sqlca.sqlerrd[2] != 1 || id != cl->users_id)
return(MR_PERM);
else
return(MR_SUCCESS);
client *cl;
{
EXEC SQL BEGIN DECLARE SECTION;
- int list_id, acl_id, flags, gid;
- char acl_type[9];
+ int list_id, acl_id, flags, gid, users_id;
+ char acl_type[9], *newname;
EXEC SQL END DECLARE SECTION;
char *client_type;
int client_id, status;
(!strcmp("dmfl", q->shortname))) &&
(!strcmp("USER", argv[1]))) {
if (*(int *)argv[2] == client_id) return(MR_SUCCESS);
- /* if update_list, don't allow them to change the GID */
+ /* if update_list, don't allow them to change the GID or rename to
+ a username other than their own */
} else if (!strcmp("ulis", q->shortname)) {
if (!strcmp(argv[7], UNIQUE_GID)) {
if(gid != -1) return MR_PERM;
} else {
if(gid != atoi(argv[7])) return MR_PERM;
}
+ newname = argv[1];
+ EXEC SQL SELECT users_id INTO :users_id FROM users
+ WHERE login=:newname;
+ if ((sqlca.sqlcode != SQL_NO_MATCH) && (users_id != client_id))
+ return MR_PERM;
}
/* check for client in access control list */
strtrim(machname));
incremental_after(USERS_TABLE, buffer, 0);
- /* create group list */
- if (set_next_object_id("gid", LIST_TABLE, 1))
- return(MR_NO_ID);
- if (set_next_object_id("list_id", LIST_TABLE, 0))
- return(MR_NO_ID);
- EXEC SQL SELECT value INTO :list_id FROM numvalues
- WHERE name='list_id';
- if (dbms_errno) return(mr_errcode);
- if (sqlca.sqlerrd[2] != 1)
- return(MR_INTERNAL);
- incremental_clear_before();
- EXEC SQL SELECT value INTO :gidval FROM numvalues WHERE name = 'gid';
- EXEC SQL INSERT INTO list
- (name, list_id, active, publicflg, hidden, maillist, grouplist,
- gid, description, acl_type, acl_id,
- modtime, modby, modwith)
- VALUES (:login, :list_id, 1, 0, 0, 0, 1,
- :gidval, 'User Group', 'USER', :users_id,
- SYSDATE, :who, :entity);
- if (dbms_errno) return(mr_errcode);
- if (sqlca.sqlerrd[2] != 1)
- return(MR_INTERNAL);
- sprintf(buffer, "l.list_id = %d", list_id);
- incremental_after(LIST_TABLE, buffer, 0);
- aargv[0] = (char *) list_id;
- aargv[1] = "USER";
- aargv[2] = (char *) users_id;
- incremental_clear_before();
- EXEC SQL INSERT INTO imembers
- (list_id, member_type, member_id, ref_count, direct)
- VALUES (:list_id, 'USER', :users_id, 1, 1);
- if (dbms_errno) return(mr_errcode);
- if (sqlca.sqlerrd[2] != 1)
- return(MR_INTERNAL);
- incremental_after(IMEMBERS_TABLE, 0, aargv);
-
if (m_id == 0) {
/* Cell Name (I know, it shouldn't be hard coded...) */
strcpy(machname, "ATHENA.MIT.EDU");
WHERE name = :machname;
}
+ EXEC SQL SELECT list_id INTO :list_id FROM list
+ WHERE name='wheel';
+
/* create filesystem */
if (set_next_object_id("filsys_id", FILESYS_TABLE, 0))
return(MR_NO_ID);
EXEC SQL UPDATE tblstats SET updates=updates+1, modtime=SYSDATE
WHERE table_name='users';
EXEC SQL UPDATE tblstats SET appends=appends+1, modtime=SYSDATE
- WHERE table_name='list' OR table_name='filesys' OR table_name='quota';
+ WHERE table_name='filesys' OR table_name='quota';
if (dbms_errno) return(mr_errcode);
return(MR_SUCCESS);
}