<<< Chronological >>> Author Index    Subject Index <<< Threads >>>

Re: 181 question

 * I tried to change an object with an older 'changed' date that the one 
 * currently in the db.  The message that was mailed out to the people
 * specified in that object's 'notify' attribute said that the
 * object had been _replaced_.  However, the object wasn't really replaced.
 * That is to say, the software realized that I was submitting an object
 * with an older 'chagned' date and prevented me from making the update.
 * So it seems to me that the message sent to the people specified in the 
 * 'notify' should read 'a change was _attempted_', yes?

It was indeed a bug. The date check and the notification were done in
the wrong order. A date check should come before notification. It was
not the notify attribute that caused this, but notification due to a
mnt-by attribute. The ordering has been fixed in the version of
updatecheck.pl below. Replace src/updatecheck.pl with the one below
and run "make" in the top level database directory.

Thanks Andy.


#	$RCSfile: updatecheck.pl,v $
#	$Revision: 1.17 $
#	$Author: marten $
#	$Date: 1995/01/16 12:45:29 $

require "defines.pl";
require "adderror.pl";
require "notify.pl";
require "maintainer.pl";

# In updatecheck one can do all the checks one wants because one has both
# the old and the new object. All checks in here are VERY RIPE database
# specific.

# It is supposed to be like this:
# *cur = empty : addition
# *new = empty : deletion
# non  = empty : update

sub updatecheck {

    local(*cur, *new, *db) = @_;
    local($email, $date) = "";
    local($newdate) = "";
    local($curdate) = "";
    local($stat) = $OK;
    local($type) = &entype(*new);

    # If this is a maintainer object, bounce it of to the human mailbox
    # configured in the config and sent them a message explaining this.
    # We use the GENERAL ERROR for this (since that one can add anytext)
    if ($type eq "mt") {
	if (!$cur{"mt"} && !$new{"uo"}) {
	    # This is a new maintainer object
	    &adderror(*new, "maintainer objects cannot be created automatically");
	    &adderror(*new, "This object has been forwarded to <$HUMAILBOX>");
	    &adderror(*new, "for authorisation");
	    if (open (TMPMAIL, ">$TMPDIR/mtfw.$$")) {
		eval "print \"$MTFWHEADER\n\";";
		eval "print \"$MTFWTEXT\";";
		print "\n" if &enwrite(*new, 1, 0, 0);
		select (STDOUT);
		system("$MAILCMD < $TMPDIR/mtfw.$$");
	    } else {
		&adderror(*new, "!! an error occured, please send object to <$HUMAILBOX> !!");
		&syslog("ERRLOG", "updatecheck cannot open file to forward maintainer object $new{\"mt\"}\n");
	    return $E_GENERAL;

    # Check update date
    foreach (split(/\n/, $new{"ch"})) {
	($email, $date) = split(/\s+/, $_);
	if ($date gt $newdate) { $newdate = $date; }
    foreach (split(/\n/, $cur{"ch"})) {
	($email, $date) = split(/\s+/, $_);
	if ($date gt $curdate) { $curdate = $date; }
    if ($newdate lt $curdate) {
	return $E_OLDER;

    # Check authorisation by maintainer unless override is specified.

    if (!$new{"uo"} && !&Maintainer(*cur, *new)) {
        return $E_AUTHFAIL unless !&entype(*new);

    # Catch if called from dbdel, then skip all checks,
    # just do notification.
    if (!&entype(*new)) {
	&AddNotify(*cur, *new);
		"delete \"$new{\"$type\"}\" - \"$cur{\"ud\"}\"");
    # Reset guarded values unless it has the "override" attribute
    &addguard(*new, *cur) unless $new{"uo"};
    &AddNotify(*cur, *new);

    # Log special actions

    if ($new{"uo"}) {
		"override by \"$new{\"uo\"}\" for \"$new{\"$type\"}\"");

    if ($new{"ua"}) {
		"authorise by \"$new{\"ua\"}\" for \"$new{\"$type\"}\"");

    return $stat;

# Resetting guarded values if necessary

sub addguard {

    local(*new, *cur) = @_;
    local($stat) = $OK;

    foreach (split(/\s+/, $GRD{$type})) {
	if ($new{$_} ne $cur{$_}) {
			"update of guarded attribute \"$ATTL{$_}\" ignored");
	    $new{$_} = $cur{$_};



<<< Chronological >>> Author    Subject <<< Threads >>>