Commit aba1120b authored by Leigh Stoller's avatar Leigh Stoller

Minor changes to a few queries that were using uid instead of uid_idx,

All queries on the tables must use uid_idx if things are to work
properly in the face of archived and non-local users! Lots of queries
to change.
parent 48ffb9c2
......@@ -1855,7 +1855,7 @@ COMMAND_PROTOTYPE(doaccounts)
" p.trust,g.pid,g.gid,g.unix_gid,u.admin, "
" u.emulab_pubkey,u.home_pubkey, "
" UNIX_TIMESTAMP(u.usr_modified), "
" u.usr_email,u.usr_shell "
" u.usr_email,u.usr_shell,u.uid_idx "
"from group_membership as p "
"join users as u on p.uid_idx=u.uid_idx "
"join groups as g on p.pid=g.pid "
......@@ -1863,7 +1863,7 @@ COMMAND_PROTOTYPE(doaccounts)
" and u.webonly=0 "
" and g.unix_id is not NULL "
" and u.status='active' order by u.uid",
14, reqp->pid, reqp->gid);
15, reqp->pid, reqp->gid);
}
else if (nodetypeprojects) {
/*
......@@ -1878,7 +1878,7 @@ COMMAND_PROTOTYPE(doaccounts)
"UNIX_TIMESTAMP(u.usr_modified), "
"u.usr_email,u.usr_shell, "
"u.widearearoot,u.wideareajailroot, "
"u.usr_w_pswd "
"u.usr_w_pswd,u.uid_idx "
"from projects as p "
"join group_membership as m on "
" m.pid_idx=p.pid_idx "
......@@ -1898,7 +1898,7 @@ COMMAND_PROTOTYPE(doaccounts)
" where n.node_id='%s' and "
" na.attrkey='project_accounts')) > 0) "
"order by u.uid",
17, reqp->nodeid);
18, reqp->nodeid);
}
else if (reqp->islocal || reqp->isvnode) {
/*
......@@ -1921,7 +1921,7 @@ COMMAND_PROTOTYPE(doaccounts)
" UNIX_TIMESTAMP(u.usr_modified), "
" u.usr_email,u.usr_shell, "
" u.widearearoot,u.wideareajailroot, "
" u.usr_w_pswd "
" u.usr_w_pswd,u.uid_idx "
"from group_membership as p "
"join users as u on p.uid_idx=u.uid_idx "
"join groups as g on "
......@@ -1932,7 +1932,7 @@ COMMAND_PROTOTYPE(doaccounts)
" %s "
" and g.unix_gid is not NULL "
"order by u.uid",
17, reqp->pid, adminclause);
18, reqp->pid, adminclause);
}
else if (reqp->jailflag) {
/*
......@@ -1946,7 +1946,7 @@ COMMAND_PROTOTYPE(doaccounts)
" UNIX_TIMESTAMP(u.usr_modified), "
" u.usr_email,u.usr_shell, "
" u.widearearoot,u.wideareajailroot, "
" u.usr_w_pswd "
" u.usr_w_pswd,u.uid_idx "
"from group_membership as p "
"join users as u on p.uid_idx=u.uid_idx "
"join groups as g on "
......@@ -1954,7 +1954,7 @@ COMMAND_PROTOTYPE(doaccounts)
"where (p.pid='%s') and p.trust!='none' "
" and u.status='active' and u.admin=1 "
" order by u.uid",
17, RELOADPID);
18, RELOADPID);
}
else {
/*
......@@ -2006,7 +2006,7 @@ COMMAND_PROTOTYPE(doaccounts)
"UNIX_TIMESTAMP(u.usr_modified), "
"u.usr_email,u.usr_shell, "
"u.widearearoot,u.wideareajailroot, "
"u.usr_w_pswd "
"u.usr_w_pswd,u.uid_idx "
"from projects as p "
"join group_membership as m "
" on m.pid=p.pid "
......@@ -2021,7 +2021,7 @@ COMMAND_PROTOTYPE(doaccounts)
" and g.unix_gid is not NULL "
" and u.status='active' "
"order by u.uid",
17, subclause);
18, subclause);
}
if (!res) {
......@@ -2227,8 +2227,8 @@ COMMAND_PROTOTYPE(doaccounts)
*/
pubkeys_res = mydb_query("select idx,pubkey "
" from user_pubkeys "
"where uid='%s'",
2, row[0]);
"where uid_idx='%s'",
2, row[17]);
if (!pubkeys_res) {
error("ACCOUNTS: %s: DB Error getting keys\n", row[0]);
......@@ -2294,8 +2294,8 @@ COMMAND_PROTOTYPE(doaccounts)
*/
sfskeys_res = mydb_query("select comment,pubkey "
" from user_sfskeys "
"where uid='%s'",
2, row[0]);
"where uid_idx='%s'",
2, row[17]);
if (!sfskeys_res) {
error("ACCOUNTS: %s: DB Error getting SFS keys\n", row[0]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment