Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: DAViCal: General

trouble with default_privileges

 

 

DAViCal general RSS feed   Index | Next | Previous | View Threaded


steinberg at ibr

Sep 29, 2011, 5:11 AM

Post #1 of 6 (269 views)
Permalink
trouble with default_privileges

Hi,

for a long time I did not update my local users and groups from the underlying LDAP. When I did this again these days, I notices a couple of error messages and none of the expected new users in the database.

As fas as I can tell today, the problem seems to be the fact that in Principal.php default_privileges is set to an integer value:

$field_values->{'default_privileges'} = decbin(privilege_to_bits($c->default_privileges));

which results in SQL commands that contain integers instead of BIT(24)-values. This probably needs to be fixed in libawl which does not yet support BITs.

Cheers,

-frank
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Davical-general mailing list
Davical-general [at] lists
https://lists.sourceforge.net/lists/listinfo/davical-general


rindfuss at wzb

Sep 29, 2011, 7:42 AM

Post #2 of 6 (266 views)
Permalink
Re: trouble with default_privileges [In reply to]

On 29.09.2011 14:11, Frank Steinberg wrote:
> Hi,
>
> for a long time I did not update my local users and groups from the
> underlying LDAP. When I did this again these days, I notices a couple
> of error messages and none of the expected new users in the
> database.
>
> As fas as I can tell today, the problem seems to be the fact that in
> Principal.php default_privileges is set to an integer value:
>
> $field_values->{'default_privileges'} =
> decbin(privilege_to_bits($c->default_privileges));
>
> which results in SQL commands that contain integers instead of
> BIT(24)-values. This probably needs to be fixed in libawl which does
> not yet support BITs.
>


Hi Frank,

You can fix this in two steps.

First, set
$c->expand_pdo_parameters = false;
in the config file

Second, change the above line to
$field_values->{'default_privileges'} =
sprintf('%024s', decbin(privilege_to_bits($c->default_privileges)));

Cheers, Peter

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Davical-general mailing list
Davical-general [at] lists
https://lists.sourceforge.net/lists/listinfo/davical-general


steinberg at ibr

Sep 30, 2011, 1:32 AM

Post #3 of 6 (274 views)
Permalink
Re: trouble with default_privileges [In reply to]

Thanks a lot!

(Wouldn't it be reasonable to apply this change upstream?)

-frank

Am 29.09.2011 um 16:42 schrieb Peter Rindfuss:

> On 29.09.2011 14:11, Frank Steinberg wrote:
>> Hi,
>>
>> for a long time I did not update my local users and groups from the
>> underlying LDAP. When I did this again these days, I notices a couple
>> of error messages and none of the expected new users in the
>> database.
>>
>> As fas as I can tell today, the problem seems to be the fact that in
>> Principal.php default_privileges is set to an integer value:
>>
>> $field_values->{'default_privileges'} =
>> decbin(privilege_to_bits($c->default_privileges));
>>
>> which results in SQL commands that contain integers instead of
>> BIT(24)-values. This probably needs to be fixed in libawl which does
>> not yet support BITs.
>>
>
>
> Hi Frank,
>
> You can fix this in two steps.
>
> First, set
> $c->expand_pdo_parameters = false;
> in the config file
>
> Second, change the above line to
> $field_values->{'default_privileges'} =
> sprintf('%024s', decbin(privilege_to_bits($c->default_privileges)));
>
> Cheers, Peter


------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Davical-general mailing list
Davical-general [at] lists
https://lists.sourceforge.net/lists/listinfo/davical-general


andrew at morphoss

Sep 30, 2011, 2:10 AM

Post #4 of 6 (299 views)
Permalink
Re: trouble with default_privileges [In reply to]

On Fri, 2011-09-30 at 10:32 +0200, Frank Steinberg wrote:
> Thanks a lot!
>
> (Wouldn't it be reasonable to apply this change upstream?)

Well... The reason for the $c->expand_pdo_parameters option in the
first place is so that DAViCal can work around variations in the way
PHP's PDO drivers handle parsing of named parameters in SQL statements -
something that DAViCal uses rather a lot.

I guess the issue (as Frank points out) is that AWL does not handle the
SQL 'BIT' type correctly and this is where the fix should really be
applied.

Frank's is a good workaround though.

Cheers,
Andrew.
>
> -frank
>
> Am 29.09.2011 um 16:42 schrieb Peter Rindfuss:
>
> > On 29.09.2011 14:11, Frank Steinberg wrote:
> >> Hi,
> >>
> >> for a long time I did not update my local users and groups from the
> >> underlying LDAP. When I did this again these days, I notices a couple
> >> of error messages and none of the expected new users in the
> >> database.
> >>
> >> As fas as I can tell today, the problem seems to be the fact that in
> >> Principal.php default_privileges is set to an integer value:
> >>
> >> $field_values->{'default_privileges'} =
> >> decbin(privilege_to_bits($c->default_privileges));
> >>
> >> which results in SQL commands that contain integers instead of
> >> BIT(24)-values. This probably needs to be fixed in libawl which does
> >> not yet support BITs.
> >>
> >
> >
> > Hi Frank,
> >
> > You can fix this in two steps.
> >
> > First, set
> > $c->expand_pdo_parameters = false;
> > in the config file
> >
> > Second, change the above line to
> > $field_values->{'default_privileges'} =
> > sprintf('%024s', decbin(privilege_to_bits($c->default_privileges)));
> >
> > Cheers, Peter
>
>
> ------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously valuable.
> Why? It contains a definitive record of application performance, security
> threats, fraudulent activity, and more. Splunk takes this data and makes
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2dcopy2
> _______________________________________________
> Davical-general mailing list
> Davical-general [at] lists
> https://lists.sourceforge.net/lists/listinfo/davical-general
>

--
------------------------------------------------------------------------
andrew (AT) morphoss (DOT) com +64(272)DEBIAN
Chemist who falls in acid will be tripping for weeks.
------------------------------------------------------------------------
Attachments: signature.asc (0.82 KB)


rindfuss at wzb

Sep 30, 2011, 5:56 AM

Post #5 of 6 (277 views)
Permalink
Re: trouble with default_privileges [In reply to]

On 30.09.2011 11:10, Andrew McMillan wrote:
> On Fri, 2011-09-30 at 10:32 +0200, Frank Steinberg wrote:
>> Thanks a lot!
>>
>> (Wouldn't it be reasonable to apply this change upstream?)
>
> Well... The reason for the $c->expand_pdo_parameters option in the
> first place is so that DAViCal can work around variations in the way
> PHP's PDO drivers handle parsing of named parameters in SQL statements -
> something that DAViCal uses rather a lot.
>
> I guess the issue (as Frank points out) is that AWL does not handle the
> SQL 'BIT' type correctly and this is where the fix should really be
> applied.
>

I agree that it would be better to fix this in AWL.

But it might still be necessary to replace

decbin(privilege_to_bits($c->default_privileges));

by

sprintf('%024s', decbin(privilege_to_bits($c->default_privileges)));

because the 24-bit field has to be right justified. [.At least, this
method is used in some other places in the davical code]. Postgresql
would left-justify a string of zeroes and ones that is shorter than 24
chars.

Best, Peter





------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Davical-general mailing list
Davical-general [at] lists
https://lists.sourceforge.net/lists/listinfo/davical-general


andrew at morphoss

Sep 30, 2011, 6:17 AM

Post #6 of 6 (278 views)
Permalink
Re: trouble with default_privileges [In reply to]

On Fri, 2011-09-30 at 14:56 +0200, Peter Rindfuss wrote:
> On 30.09.2011 11:10, Andrew McMillan wrote:
> > On Fri, 2011-09-30 at 10:32 +0200, Frank Steinberg wrote:
> >> Thanks a lot!
> >>
> >> (Wouldn't it be reasonable to apply this change upstream?)
> >
> > Well... The reason for the $c->expand_pdo_parameters option in the
> > first place is so that DAViCal can work around variations in the way
> > PHP's PDO drivers handle parsing of named parameters in SQL statements -
> > something that DAViCal uses rather a lot.
> >
> > I guess the issue (as Frank points out) is that AWL does not handle the
> > SQL 'BIT' type correctly and this is where the fix should really be
> > applied.
> >
>
> I agree that it would be better to fix this in AWL.
>
> But it might still be necessary to replace
>
> decbin(privilege_to_bits($c->default_privileges));
>
> by
>
> sprintf('%024s', decbin(privilege_to_bits($c->default_privileges)));
>
> because the 24-bit field has to be right justified. [.At least, this
> method is used in some other places in the davical code]. Postgresql
> would left-justify a string of zeroes and ones that is shorter than 24
> chars.

True. I've applied that now.

Cheers,
Andrew.


--
------------------------------------------------------------------------
andrew (AT) morphoss (DOT) com +64(272)DEBIAN
Lookie, lookie, here comes cookie...
-- Stephen Sondheim
------------------------------------------------------------------------
Attachments: signature.asc (0.82 KB)

DAViCal general RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.