Commit 1efa2a31 authored by Leigh B Stoller's avatar Leigh B Stoller

Add "updated" timestamp to the nonlocal_users_table to mirror

the same field in the users table, so that clients know to update
users.
parent 06c87f2e
......@@ -4621,12 +4621,18 @@ sub BindNonLocalUser($$$$$$)
if ($query_result->numrows) {
($uid_idx) = $query_result->fetchrow_array();
# Mark for update.
DBQueryWarn("update nonlocal_user_accounts set updated=now() ".
"where uid_idx='$uid_idx'")
or return -1;
}
else {
my @insert_data = ();
$uid_idx = User->NextIDX();
push(@insert_data, "created=now()");
push(@insert_data, "updated=now()");
push(@insert_data, "uid_idx='$uid_idx'");
push(@insert_data, "unix_uid=NULL");
push(@insert_data, "exptidx='$exptidx'");
......@@ -4649,7 +4655,7 @@ sub BindNonLocalUser($$$$$$)
DBQueryWarn("delete from nonlocal_user_pubkeys ".
"where uid_idx='$uid_idx'")
or return -1;
foreach my $key (@{ $keys }) {
my $safe_key = DBQuoteSpecial($key);
......
......@@ -2936,6 +2936,7 @@ CREATE TABLE `nonlocal_user_accounts` (
`uid_uuid` varchar(40) NOT NULL default '',
`unix_uid` smallint(5) unsigned NOT NULL auto_increment,
`created` datetime default NULL,
`updated` datetime default NULL,
`urn` tinytext,
`name` tinytext,
`email` tinytext,
......
#
# Add updated timestamp to nonlocal_user_accounts
#
use strict;
use libdb;
my $impotent = 0;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
if (!DBSlotExists("nonlocal_user_accounts", "updated")) {
DBQueryFatal("alter table nonlocal_user_accounts add ".
" `updated` datetime default NULL after created");
DBQueryFatal("update nonlocal_user_accounts set updated=created");
}
return 0;
}
# Local Variables:
# mode:perl
# End:
......@@ -3260,7 +3260,7 @@ COMMAND_PROTOTYPE(doaccounts)
" u.name, "
" 'local_root',g.pid,g.gid,g.unix_gid,0, "
" NULL,NULL, "
" UNIX_TIMESTAMP(u.created), "
" UNIX_TIMESTAMP(u.updated), "
" u.email,'csh', "
" 0,0, "
" NULL,u.uid_idx "
......
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