equality index of attribute "privateEmail" disallowed - openldap

I'm installed OpenLDAP 2.4 to CentOS 6 server.
Added custom attributes and schema 'myUser':
dn: cn=my,cn=schema,cn=config
objectClass: olcSchemaConfig
cn: my
objectClass: top
olcAttributeTypes: ( 331.332.333.1 NAME 'firstName' DESC 'First name of a person' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
olcAttributeTypes: ( 331.332.333.2 NAME 'privateEmail' DESC 'Private email of a person' SYNTAX 1.3.6.1.4.1.1466.115.121.1.41 X-ORIGIN 'user defined' )
olcAttributeTypes: ( 331.332.333.3 NAME 'userOid' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'user defined' )
olcAttributeTypes: ( 331.332.339.4 NAME 'isTrusted' DESC 'Determines if user is trusted' SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE X-ORIGIN 'user defined' )
olcAttributeTypes: ( 331.332.333.6 NAME 'gender' DESC 'Person gender (M,F or U)' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'user defined' )
olcAttributeTypes: ( 331.332.333.8 NAME 'privatePhone' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'user defined' )
olcAttributeTypes: ( 331.332.333.9 NAME 'otpContact' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'user defined' )
olcAttributeTypes: ( 331.332.333.10 NAME 'otpAuthnFlag' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'user defined' )
olcAttributeTypes: ( 331.332.333.11 NAME 'lastName' DESC 'Last name of a person' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'user defined' )
olcAttributeTypes: ( 2.16.840.1.113730.3.1.610 NAME 'nsAccountLock' DESC 'Operational attribute for Account Inactivation' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
olcObjectClasses: ( 331.332.333.12 NAME 'myUser' DESC 'user for my entity' SUP top STRUCTURAL MUST ( uid $ isTrusted $ nsAccountLock $ firstName ) MAY ( lastName $ userPassword $ privateEmail $ otpContact $ otpAuthnFlag $ privatePhone $ userOid ) X-ORIGIN 'user defined' )
Trying to add the index and get the error:
# ldapadd -x -W -D cn=config -f /opt/index.ldif
Enter LDAP Password:
modifying entry "olcDatabase={2}bdb, cn=config"
ldap_modify: Other (e.g., implementation specific) error (80)
additional info: equality index of attribute "privateEmail" disallowed
My index.ldif:
dn: olcDatabase={2}bdb, cn=config
changetype: modify
add: olcDbIndex
olcDbIndex: privateEmail eq
olcDbIndex: privatePhone eq

You're using the wrong syntax OID for privateEmail. The one you're using is for Postal Addresses, and it doesn't support indexing. See RFC 4517.
You should be using 1.3.6.1.4.1.1466.115.121.1.26 as per RFC 2798. Check the others for sanity as well.

Related

Symfony 4.2 utf8 data cut off when saving to MySQL

I'm saving a heading from a CSV file to the database.
Viewed with less on Ubuntu the file starts like this:
Date,Supermarket,Speciality,Takeaway,Caf<E9>/restaurant
1/06/2019,0.039175903,-0.01496395,0.03603785,0.029072835
1/07/2019,0.039399919,-0.008250166,0.022385733,0.015478668
The heading data is ($csvHeader)
Array
(
[0] => Date
[1] => Supermarket
[2] => Speciality
[3] => Takeaway
[4] => Caf�/restaurant
)
ord(substr($csvHeader,3,1)) === 233
This is read with the following function
protected function getCsvHeaders()
{
$fh = fopen( $this->getCsvPath(), 'r+' );
$firstrow = fgetcsv( $fh );
fclose( $fh );
return $firstrow;
}
This is saved to a table DataConfiguration:
$dataConf
->setColumns(serialize($csvHeader));
which is set to utf8mb4:
show create table data_configuration;
+--------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+--------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| data_configuration | CREATE TABLE `data_configuration` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`data_set_id` int(11) NOT NULL,
`file_type_id` int(11) NOT NULL,
`columns` varchar(7500) COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `unique_idx` (`data_set_id`,`file_type_id`),
KEY `IDX_54A0B1FD70053C01` (`data_set_id`),
KEY `IDX_54A0B1FD9E2A35A8` (`file_type_id`),
CONSTRAINT `FK_54A0B1FD70053C01` FOREIGN KEY (`data_set_id`) REFERENCES `data_set` (`id`),
CONSTRAINT `FK_54A0B1FD9E2A35A8` FOREIGN KEY (`file_type_id`) REFERENCES `file_type` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13176 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci |
Doctrine seems to be configured for utf8mb4 as well:
doctrine:
dbal:
# configure these for your database server
driver: 'pdo_mysql'
# server_version: '5.7'
charset: utf8mb4
default_table_options:
charset: utf8mb4
collate: utf8mb4_unicode_ci
url: '%env(resolve:DATABASE_URL)%'
options:
1001: true
However the data gets cut off at the utf8 character and subsequent unserialize fails. I can reproduce this on my Ubuntu 18/ AWS RDS environment as well as my local MacOS/Brew environment.
What other avenues can I explore to solve this problem?
You are parsing a text file with fgetcsv(). Its documentation states you can encounter issues when using single-byte encoded files:
The locale settings are taken into account by this function. If LC_CTYPE is e.g. en_US.UTF-8, files in one-byte encodings may be read wrongly by this function.
https://www.php.net/manual/en/function.fgetcsv.php
If your file contains French characters that exist beyond the basic ASCII table, you may set this variable to another value:
List installed locales : sh locale -a
en_US.utf8
fr_FR.iso885915
...
The output may vary. I cannot tell you a locale that's guaranteed to exist on your machine. You have to pick something like ISO-8859-1, Windows-1252, not UTF-8.
Before calling fgetcsv(), set the locale to something that matches the file encoding:
setlocale(LC_CTYPE, 'fr_FR.iso885915');
Call fgetcsv()
Alternatively, you can manually convert the encoding:
$row_utf8 = mb_convert_encoding($row_raw, "Windows-1252", "UTF-8");
What does file your.csv gives?

Oracle Advanced QUEUE does not exist is other schema

I have the same problem that is described in this issue: Grant permission to queues to another schema in oracle.
But given permissions to the other user doesn't work at all.
My queue:
DBMS_AQADM.create_queue_table (
queue_table => 'event_queue_tab',
queue_payload_type => 't_event_queue_payload',
multiple_consumers => TRUE,
comment => 'Queue Table For Event Messages',
secure => false);
-- Create the event queue.
DBMS_AQADM.create_queue (queue_name => 'event_queue',
queue_table => 'event_queue_tab');
-- Start the event queue.
DBMS_AQADM.start_queue (queue_name => 'event_queue');
This queue as created using schema USER1. In this schema, I have a package pkg1 with a procedure when I call it, its enqueue:
PROCEDURE proc1
IS
PRAGMA AUTONOMOUS_TRANSACTION;
l_enqueue_options DBMS_AQ.ENQUEUE_OPTIONS_T;
l_message_properties DBMS_AQ.MESSAGE_PROPERTIES_T;
l_message_handle RAW (16);
l_queue_msg t_event_queue_payload;
BEGIN
l_queue_msg := t_event_queue_payload ('give_me_a_prod');
DBMS_AQ.enqueue (queue_name => 'event_queue',
enqueue_options => l_enqueue_options,
message_properties => l_message_properties,
payload => l_queue_msg,
msgid => l_message_handle);
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line (
SQLERRM || ' - ' || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE);
END proc1;
I have a second schema USER2 who have privileges to execute pkg1 by a specific ROLE (ROLE1). But when he calls proc1, receive the next error:
ORA-24010: QUEUE USER2.EVENT_QUEUE does not exist - ORA-06512: at "SYS.DBMS_AQ", line 180
ORA-06512: at "USER1.PKG1", line 1808
I've executed this privilege command in USER1 but without success:
BEGIN
DBMS_AQADM.grant_queue_privilege (privilege => 'ALL',
queue_name => 'USER1.event_queue',
grantee => 'USER2',
grant_option => TRUE);
END;
I'm really starting to understand how Ad.Queues works. Am I missing something here? Thanks.
EDIT1:
After the grant given the privileges for this queue:
SELECT grantee,
owner,
name,
grantor,
enqueue_privilege,
dequeue_privilege
FROM queue_privileges
WHERE name = upper('event_queue');
ROLE1 USER1 EVENT_QUEUE USER1 1 1
USER2 USER1 EVENT_QUEUE USER1 1 1
Just a guess, does it have something to do with synonyms? Because the error message says USER2.QUEUE doesn't exist. Maybe its not able to touch User1 queue, because internally it is trying to find it in it's own schema? Try giving queue name in procedure as user1.event_queue.
What I mean is:
PROCEDURE proc1
IS
PRAGMA AUTONOMOUS_TRANSACTION;
l_enqueue_options DBMS_AQ.ENQUEUE_OPTIONS_T;
l_message_properties DBMS_AQ.MESSAGE_PROPERTIES_T;
l_message_handle RAW (16);
l_queue_msg t_event_queue_payload;
BEGIN
l_queue_msg := t_event_queue_payload ('give_me_a_prod');
DBMS_AQ.enqueue (queue_name => 'user1.event_queue',
enqueue_options => l_enqueue_options,
message_properties => l_message_properties,
payload => l_queue_msg,
msgid => l_message_handle);
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line (
SQLERRM || ' - ' || DBMS_UTILITY.FORMAT_ERROR_BACKTRACE);
END proc1;
Why I say so? Because when you are giving permission you are explicitly mentioning the schema USER1 before event_queue, and that procedure works. But not doing the same when using the enqueue procedure.

ORA-01830 Error for 11.2.0 client but not for 10.2 client

I have this piece of code:
BEGIN
DBMS_SCHEDULER.DROP_JOB (
job_name => 'LOANSBUILD.LOANSNEWYORKCLOSE');
END;
/
BEGIN
DBMS_SCHEDULER.CREATE_JOB (
job_name => '***.LOANSNEWYORKCLOSE',
job_type => 'PLSQL_BLOCK',
job_action => 'begin loans_schedule_job.loans_close(TRUNC(SYSDATE), ''N''); end;',
start_date => '15-NOV-08 12.00.00.000000000 AM AMERICA/NEW_YORK',
repeat_interval => 'FREQ=WEEKLY;BYDAY=MON,TUE,WED,THU,FRI;BYHOUR=16;BYMINUTE=0;BYSECOND=0',
auto_drop => FALSE,
job_class => 'DEFAULT_JOB_CLASS',
enabled => TRUE,
comments => 'Test.'
);
END;
/
exit;
When the above is executed from an environment which has oracle sql client 10.2 installed , this goes fine but when the same is executed fron an environment that has 11.2 client installed, this fails as below:
BEGIN
*
ERROR at line 1:
ORA-01830: date format picture ends before converting entire input string
ORA-06512: at line 2
The variable nls_date_format is set to 'DD-MON-RR' in the 10.2 environment and set to 'YYYY-MM-DD HH24:MI:SS' in the 11.2 env.
As this was getting compiled for 10.2 env, I updated nls_lang_date in the 11.2 env as well to make it 'DD-MON-RR' but even after that I get the same error. Is there anything else I should be setting.
Please note that I am sysadmin and as this code is getting compiled on of the server, my job is to ensure that it does on others as well. Which also means that I do not have permissions to update code.
According to the CREATE_JOB Procedure documentation, the parameter start_date must be of type TIMESTAMP WITH TIME ZONE.
In your PL/SQL code you are instead passing a string thus relying on implicit conversion.
You could instead use an explicit conversion to the TIMESTAMP WITH TIME ZONE data type such as:
TO_TIMESTAMP_TZ('15-NOV-08 12.00.00.000000000 AM AMERICA/NEW_YORK', 'DD-MON-RR HH:MI:SS.FF AM TZR')

adding custom attributes to openldap

This is my first time at LDAP . I have setup an openldap on ubuntu machine and an ldap browser (phpldapadmin) on the remote system .I 'm trying to add two custom attributes to the cn=config and i get a successful message but if i see the attributes or the schema in the ldap browser its no where visible , please let me know where i'm going wrong . Below are the steps i have taken
1)Creating custom.schema file
#file to add custom schemas to the ldap
attributetype ( 1.7.11.1.1
NAME 'studentid'
DESC 'unique id given to each student of the college'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
attributetype ( 1.7.11.1.2
NAME 'pexpiry'
DESC 'indicated the date of password expiry'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
objectClass ( 1.7.11.1.1.100
NAME 'Studentinfo'
DESC 'Studentinfo object classes '
SUP top
AUXILIARY
MUST ( studentid $ pexpiry $
)
)
2)Create an ldif file
#ldif file containing the custom schema
dn: cn=custom,cn=schema,cn=config
objectClass: olcSchemaConfig
cn: custom
olcAttributeTypes: ( 1.7.11.1.1
NAME 'studentid'
DESC 'unique id given to each student of the college'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
olcAttributeTypes: ( 1.7.11.1.2
NAME 'pexpiry'
DESC 'indicated the date of password expiry'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
olcObjectClasses: ( 1.7.11.1.1.100
NAME 'Studentinfo'
DESC 'Studentinfo object class '
SUP top
AUXILIARY
MUST ( studentid $ pexpiry $
)
)
3)Add the ldif file to the cn=config using the below command
ldapadd -x -h 192.168.2.3 -D "cn=admin,cn=config" -W -f ./custom.ldif
It first asks for password , i enter the password and i get the message as
Adding entry "cn=custom,cn=schema,cn=config"
But when i goto browser i don't see the schema nor the attributes there .I tried to add an user it said invalid attributes .
1] Add custom schema in slapd.conf and restart LDAP service.If Everything is ok service will start properly otherwise it will give error.
2] After this if possible use Apache Studio for browsing,i was also not able to see the custom object in other browsers.

unable to create users on OpenLDAP having german umlauts

When I try to add a user on OpenLDAP 2.4.32 using ldapmodify which has a german umlaut I get a ldap syntax error
ldapmodify.exe" -a -x -H ldap://localhost -D %LDAP_ROOT% -w %LDAP_SECRET%
dn:uid=aöich,ou=Users,dc=cricbox,dc=in
changetype: add
objectClass:person
objectClass:inetOrgPerson
objectClass:organizationalPerson
uid:aöich
cn:aöich
sn:aöich
ldap_add: Invalid DN syntax (34)
additional info: invalid DN
How to add a user with german mmlaut character on OpenLDAP server ?
Check if your databank schema supports Unicode. Check LDAP documentation here:
attributeType ( 2.5.4.41 NAME 'name'
DESC 'name(s) associated with the object'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} )
attributeType ( 2.5.4.3 NAME ( 'cn' 'commonName' )
DESC 'common name(s) assciated with the object'
SUP name )
Your attributes should contain:
directoryString 1.3.6.1.4.1.1466.115.121.1.15 Unicode (UTF-8) string

Resources