Mailing List Archive

unknown sql_from_object
Hi Andr?


On Wed, November 11, 2009 11:43, Roth Andr? wrote:
> For several users, not for everyone, login was not possible anymore,
> because
> the function sql_from_object was not found in
> /usr/share/davical/inc/auth-functions.php, line 127.
>
> I remeber having seen something about this on the mailing list, and I
> thought this was corrected.

If it is indeed the same problem (I had your symptom with DAViCal 0.9.7.6,
using LDAP authentication), then as far as I know it should be fixed in
the main codeline of DAViCal, which will form the basis for the next
release.



> I put the following in front of the failing function:
> ===============
> if( ! function_exists( "sql_from_object" ))
> include "/usr/share/awl/inc/DataUpdate.php";
>
> $qry = new PgQuery( sql_from_object( $usr, $type, 'usr', "WHERE
> user_no=$usr->user_no" ) );
> ================
> and the user was able to login again.


My fix was to comment out line 28 in auth-functions.php, which looks like
this:

if ( function_exists('CreateHomeCalendar') ) return(true);

I'm not sure if this is any better than your solution, you should probably
wait for Andrew's comment, he is the authorative voice here.



> What's funny, if I remove this change again, the user is still able to
> login, the problem seems to be gone. Is this a database update issue ?

Yep, same here. I did a bit of experimenting, and I believe the reason is
this:

1) Upon login, DAViCal detects that it needs to sync its database records
with the information stored in LDAP. I believe this happens if the
timestamp on the LDAP user DN (attribute modifyTimestamp) is newer than a
similar timestamp in the database.

2) The attempt to sync triggers the error; the sync is aborted and login
fails.

3) On the next login attempt, see 1)

4) Once the include problem has been fixed, the sync on the next login
attempt will be successful. The database timestamp is updated, so from now
on syncing is no longer necessary.

5) Since DAViCal no longer invokes the missing function, the change which
fixed the include problem can be reverted and login will proceed without
error.

6) BUT: If you modify the user DN in LDAP, the LDAP timestamp will be
updated and the problem will reassert itself on the next login attempt.


My conclusion therefore was to leave the fix in place.


Cheers,
Patrick
unknown sql_from_object [ In reply to ]
Hello,

I have a problem since the last update:

For several users, not for everyone, login was not possible anymore,
because
the function sql_from_object was not found in
/usr/share/davical/inc/auth-functions.php, line 127.

I remeber having seen something about this on the mailing list, and I
thought this was corrected.

I put the following in front of the failing function:
===============
if( ! function_exists( "sql_from_object" ))
include "/usr/share/awl/inc/DataUpdate.php";

$qry = new PgQuery( sql_from_object( $usr, $type, 'usr', "WHERE
user_no=$usr->user_no" ) );
================
and the user was able to login again.

What's funny, if I remove this change again, the user is still able to
login, the problem seems to be gone. Is this a database update issue ?

Regards

Andr?
unknown sql_from_object [ In reply to ]
On 11/11/09 23:43, Roth Andr? wrote:
> Hello,
>
> I have a problem since the last update:
>
> For several users, not for everyone, login was not possible anymore,
> because
> the function sql_from_object was not found in
> /usr/share/davical/inc/auth-functions.php, line 127.
>
> I remeber having seen something about this on the mailing list, and I
> thought this was corrected.
>
> I put the following in front of the failing function:
> ===============
> if( ! function_exists( "sql_from_object" ))
> include "/usr/share/awl/inc/DataUpdate.php";
>
> $qry = new PgQuery( sql_from_object( $usr, $type, 'usr', "WHERE
> user_no=$usr->user_no" ) );
> ================
> and the user was able to login again.
>
> What's funny, if I remove this change again, the user is still able to
> login, the problem seems to be gone. Is this a database update issue ?
>
>
No,

The problem occurs only when the LDAP data has changed since the user
last logged in. There is a fix for the problem in the 0.9.7 branch
since 0.9.7.6, but your solution is also fine.

Regards,
Andrew.