[Home]

Summary:ASTERISK-12921: [patch] ERROR[7387]: res_config_ldap.c:1292 update_ldap: Couldn't modify dn:cn=1001,dc=xxx,dc=xxx because Invalid syntax
Reporter:Marc Fricou (macogeek)Labels:
Date Opened:2008-10-17 04:25:58Date Closed:2009-08-12 11:22:19
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Resources/res_config_ldap
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) asterisk_empty_fullcontact.log
( 1) asterisk.schema
( 2) fix_empty_attributes_1.6.1.4_v2.patch
( 3) fix_empty_attributes_1.6.1.4.patch
( 4) ldap.ldif
( 5) res_ldap.conf
( 6) slapd.log
( 7) tree.ldif
( 8) wireshark_screenshot.JPG
Description:When my softphone register, I've got a error, as you can see. After that, I've got other warning :
ERROR[7387]: res_config_ldap.c:1292 update_ldap: Couldn't modify dn:cn=1001,dc=xxx,dc=xxx because Invalid syntax    -- Registered SIP '1001' at 192.168.50.124 port 25880 expires 3600
[Oct 17 11:18:45] NOTICE[7387]: chan_sip.c:9809 __set_address_from_contact: '' is not a valid SIP contact (missing sip:) trying to use anyway
[Oct 17 11:18:45] WARNING[7387]: chan_sip.c:9817 __set_address_from_contact: Invalid host name in Contact: (can't resolve in DNS) : '-'
So the softphone register successfully but can't call another phone.
I captured the package ldap.modifyRequest and ldap.modifyResponse with wireshark and i can see that :

LDAPMessage modifyRequest(95) "cn=1001,dc=xxx,dc=xxx"
modification AstAccountFullContact
modification AstAccountIpaddr
...(6 items)

LDAPMessage modifyResponse(95) invalidAttributeSyntax (AstAccountFullContact: value #0 invalid per syntax)
and another modifyresponse is success because the request doesn't concern AstAccountFullContact :

LDAPMessage modifyRequest(97) "cn=1001,dc=xxx,dc=xxx"
modification AstAccountIpaddr
modification AstAccountPort
...(4 items)

LDAPMessage modifyResponse(97) success

I can't see what res_config_ldap.c try to insert into the AstAccountFullContact field


thanks for your help


****** ADDITIONAL INFORMATION ******

here is my slapd.conf

include /etc/openldap/schema/core.schema
include /etc/openldap/schema/cosine.schema
include /etc/openldap/schema/inetorgperson.schema
include /etc/openldap/schema/nis.schema
include /etc/openldap/schema/asterisk.schema


pidfile /var/run/openldap/slapd.pid
argsfile /var/run/openldap/slapd.args


database bdb
suffix "dc=xxx,dc=xxx"
rootdn "cn=Manager,dc=xxx,dc=xxx"
rootpw xxx

directory /var/lib/ldap
index objectClass                       eq,pres
index ou,cn,mail,surname,givenname      eq,pres,sub
index uidNumber,gidNumber,loginShell    eq,pres
index uid,memberUid                     eq,pres,sub
index nisMapName,nisMapEntry            eq,pres,sub
Comments:By: snuffy (snuffy) 2008-10-17 07:19:41

Note: For alot of text please use the file upload function as it means less scrolling for everyone also makes it easier to view files seperately ;)

By: Gavin Henry (suretec) 2008-10-17 07:24:32

AstAccountFullContact is the right syntax. A typical FullContact entry is like:

FullContact = sip:user@192.168.10.1:5061

So there's some problem with res_ldap.c adding sip:user@192.168.10.1:5061 to AstAccountFullContact.

Let me quickly test. Can you upload you ldap logs too?

Thanks.

By: Marc Fricou (macogeek) 2008-10-17 07:47:04

sorry for that, i was unable to find how to upload files first time. I uploaded the slapd.log. Now, how can i modify my mistake?

By: Gavin Henry (suretec) 2008-10-17 07:53:23

You can let us test and be patient ;-)

Can you run slapcat and upload whatever data, if any, you have for AstAccountFullContact

By: Gavin Henry (suretec) 2008-10-17 08:58:40

Can you upload the ldif data you added, your res_ldap.conf

Can you also try deleting:

fullcontact = gecos

from res_ldap.conf

I think that shouldn't be there as it's pulling in gecos.

By: Marc Fricou (macogeek) 2008-10-17 09:22:38

excuse me, i was with my boss. I uploaded the ldif file but i haven't any gecos in my res_ldap.conf file. Please note that I put the right value on fullcontact attribute by myself, it was empty before. As you can see, port and ipaddress are good. But the expirationtimestamp was not a good value. I changed it too.

By: Marc Fricou (macogeek) 2008-10-17 09:34:57

I found the gecos line and deleted it. But I have the same problem.

By: Gavin Henry (suretec) 2008-10-17 09:38:39

OK, I'm just testing your data.

Thanks.

By: Marc Fricou (macogeek) 2008-10-17 09:48:43

i uploaded a new ldif file tree.ldif in witch I just have modified dc (dc=xxx,dc=xxx). Just be careful with my data i tried to modified all dc=xxx before upload.

By: Gavin Henry (suretec) 2008-10-17 09:51:26

Where did you get this schema from?

The latest version is in:

asterisk-1.6.0.1/contrib/scripts/asterisk.ldap-schema

and has:

#
# Copyright (c) 2007-2008 Suretec Systems Ltd. - <http://www.suretecsystems.com/>
#
# Version: 3.1.6
#
# Changes:
# - http://bugs.digium.com/view.php?id=12860 - 04/07/2008
# - Fixed wrong DESC - 07/05/2008
#
# Author: Gavin Henry - <ghenry@suretecsystems.com>

At the top.

What does yours have?

By: Marc Fricou (macogeek) 2008-10-17 09:52:06

i'm sorry but in my country, it's 5 o'clock and it's the end of the day. I'll come back on monday. Thanks for your help and good luck. See you on monday.

By: Marc Fricou (macogeek) 2008-10-17 09:54:01

http://www.voip-info.org/wiki/view/LDAP
because the schema was'nt correspond to res-ldap.conf mapping.

By: Gavin Henry (suretec) 2008-10-17 10:02:41

Yes, we'll change the res_ldap.conf file then. You shouldn't use random schemas hosted on the net. There is a bug closed for this and res_ldap.conf probably wasn't in your version:

http://bugs.digium.com/view.php?id=12860



By: Marc Fricou (macogeek) 2008-10-20 01:57:36

I agree, but my schema isn't the cause. As you can see AstAccountFullContact has the same definition. I tried to change my schema and my res_ldap.conf with the ones you told me to use and it's te same result.

(I have modified something : AsteriskSIPUser is structural because my ldap tree was empty and it's not AsteriskExtention child because i don't need to use extension in realtime)

I don't think my modification is the cause but perhaps I'm wrong.

By: Marc Fricou (macogeek) 2008-10-20 02:36:37

In my first message, i said that i was unable to see (with wireshark)what res_config_ldap.c try to insert into the AstAccountFullContact field. In fact, I think it's a blank it try to insert. I join wireshark_screenshot.jpg. The first screenshot is the first request, you can see "vals" fields are empty. The second sreenshot is the second request, vals field for AsAccountIpaddress rates "192.168.50.124" (my softphone ip address i try to register).

Why res-config-ldap.c try to replace AstAccountFullcontact value with an empty field?



By: Marc Fricou (macogeek) 2008-10-20 09:42:36

I finally found a way to resolve my problem. I have just suppress the AstAccountFullContact attribute from my object "1001" and the error message disappear and i can call other phones (witch register too)... I still think that there is something wrong with res_config_ldap.c or perhaps chan_sip.c. Thanks for your help and your time.

By: Leif Madsen (lmadsen) 2009-02-02 14:32:50.000-0600

I just committed a patch for the schema stuff in res_ldap.conf today. Since I don't know much (anything) about LDAP, was that enough to close this issue as well, or is there an actual bug in the code here that still needs to be resolved?  Thanks!

By: Marc Fricou (macogeek) 2009-02-03 03:59:58.000-0600

i'm looking it today and post an other comment. The real problem come from the use of fullcontact attribute, i think.

By: Marc Fricou (macogeek) 2009-02-03 04:05:07.000-0600

I still can see :
fullcontact=gecos
fullcontact=AstAccountFullContact

I don't think it's right, is it?

By: bencer (bencer) 2009-03-01 13:57:59.000-0600

i can confirm this bug. any hint on how to fix this ?

By: bencer (bencer) 2009-03-02 04:04:55.000-0600

after hardcoding a workarround in the res_config_ldap.c for empty newval, an other issue raises with the missing useragent attribute, so i've added this to the asterisk schema:

81d80
< objectIdentifier AstAccountUserAgent AstAttrType:49
466,472d464
< attributetype ( AstAccountUserAgent
<         NAME 'AstAccountUserAgent'
<         DESC 'Asterisk Account User Agent'
<         EQUALITY caseIgnoreMatch
<         SUBSTR caseIgnoreSubstringsMatch
<         SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
<
575d566
<         AstAccountUserAgent $

By: Gavin Henry (suretec) 2009-03-02 04:21:14.000-0600

I'll check this out and debug.

Thanks.

By: bencer (bencer) 2009-03-07 07:13:56.000-0600

any progress with this issue? when do you expect to have some time to give it a look ?

By: Gavin Henry (suretec) 2009-03-07 14:51:16.000-0600

Hopefully this week.

By: bencer (bencer) 2009-03-22 13:36:37

set rtcachefriends=yes in your sip.conf acording to:

static void update_peer(struct sip_peer *p, int expire)
{
       int rtcachefriends = ast_test_flag(&p->flags[1], SIP_PAGE2_RTCACHEFRIENDS);
       if (sip_cfg.peer_rtupdate &&
           (p->is_realtime || rtcachefriends)) {
               realtime_update_peer(p->name, &p->addr, p->username, rtcachefriends ? p->fullcontact : NULL, p->useragent, expire, p->deprecated_username);
       }
}

By: Leif Madsen (lmadsen) 2009-03-26 07:24:02

bencer: is that a note that resolves this issue, or a note that defines what is necessary to reproduce the issue?

Thanks!

By: Stefan Pampel (polyformal_sp) 2009-07-02 09:20:16

@suretec @bencer

I had the same issue, in the registration process of sip clients the IP wasn't registered. Some LDAP attributes were missing, even the AstAccountUserAgent.

The LDAP schema from svn (today) doesn't ship it. Adding it in the manner of bencers post (2009-03-22 13:36) will work (see the patch)

BTW: I found an other syntax error in the scheme. All toghether in the patch I#ll attach.

best regards

Stefan Pampel

By: Gavin Henry (suretec) 2009-07-02 10:50:40

Thanks, will take a look. That attribute isn't needed really though.

By: Gavin Henry (suretec) 2009-07-27 15:35:02

@polyformal_sp

Are there any other attributes you need?

If not, I'll just add AstAccountUserAgent.

Thanks.

By: Leif Madsen (lmadsen) 2009-08-05 12:21:23

I'd just say lets get this issue closed out. Just add the attribute, and if anything further needs to be done, then a new issue can be opened by the original reporter. Thanks!

By: Peter Gerritsen (xvisor) 2009-08-12 07:32:35

The update of the schema posted above solved the issue with registering but not with unregistering. With unregistering we kept an issue in the ldap saying we couldn't update AstAccountUserAgent with value #0 invalid per syntax.

I attached a patch that solves all asterisk issues where asterisk tries to write an empty value to a ldap attribute. It's called fix_empty_attributes_1.6.1.4.patch

By: Gavin Henry (suretec) 2009-08-12 07:41:51

Is your license on file? I'll check it out and update the few that are missing.

Thanks.

By: Peter Gerritsen (xvisor) 2009-08-12 08:16:29

It's fine under every opensource license. I added a v2 because the initial patch created a crash with the debug level on 3 or higher, overlooked that.

By: Peter Gerritsen (xvisor) 2009-08-12 10:09:11

suretec: will the schema update and the my patch be applied to the next release?

Thanks

By: Gavin Henry (suretec) 2009-08-12 10:14:01

Is v2 of the patch the correct one to use?

Release engineering isn't my job ;-) I commit fixes and updates.

By: Peter Gerritsen (xvisor) 2009-08-12 10:17:13

Yeah patch v2 is the correct one to use ;-).

By: Digium Subversion (svnbot) 2009-08-12 11:01:10

Repository: asterisk
Revision: 211767

U   trunk/contrib/scripts/asterisk.ldap-schema
U   trunk/contrib/scripts/asterisk.ldif
U   trunk/res/res_config_ldap.c

------------------------------------------------------------------------
r211767 | ghenry | 2009-08-12 11:01:10 -0500 (Wed, 12 Aug 2009) | 33 lines

Added three new attributes and applied a patch to res_config_ldap.c

attributetype ( AstAccountSubscribeContext
       NAME 'AstAccountSubscribeContext'
       DESC 'Asterisk subscribe context'
       EQUALITY caseIgnoreMatch
       SUBSTR caseIgnoreSubstringsMatch
       SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)

attributetype ( AstAccountIpAddr
       NAME 'AstAccountIpAddr'
       DESC 'Asterisk aaccount IP address'
       EQUALITY caseIgnoreMatch
       SUBSTR caseIgnoreSubstringsMatch
       SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)

attributetype ( AstAccountUserAgent
       NAME 'AstAccountUserAgent'
       DESC 'Asterisk account user context'
       EQUALITY caseIgnoreMatch
       SUBSTR caseIgnoreSubstringsMatch
       SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)

and patch fix_empty_attributes_1.6.1.4_v2.patch

(closes issue ASTERISK-12921)
Reported by: macogeek
Patches:
     fix_empty_attributes_1.6.1.4_v2.patch uploaded by xvisor (license 863)
Tested by: suretec



------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=211767

By: Digium Subversion (svnbot) 2009-08-12 11:16:31

Repository: asterisk
Revision: 211768

_U  branches/1.6.0/
U   branches/1.6.0/contrib/scripts/asterisk.ldap-schema
U   branches/1.6.0/contrib/scripts/asterisk.ldif
U   branches/1.6.0/res/res_config_ldap.c

------------------------------------------------------------------------
r211768 | ghenry | 2009-08-12 11:16:31 -0500 (Wed, 12 Aug 2009) | 38 lines

Merged revisions 211767 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r211767 | ghenry | 2009-08-12 17:00:46 +0100 (Wed, 12 Aug 2009) | 33 lines
 
 Added three new attributes and applied a patch to res_config_ldap.c
 
 attributetype ( AstAccountSubscribeContext
         NAME 'AstAccountSubscribeContext'
         DESC 'Asterisk subscribe context'
         EQUALITY caseIgnoreMatch
         SUBSTR caseIgnoreSubstringsMatch
         SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
 
 attributetype ( AstAccountIpAddr
         NAME 'AstAccountIpAddr'
         DESC 'Asterisk aaccount IP address'
         EQUALITY caseIgnoreMatch
         SUBSTR caseIgnoreSubstringsMatch
         SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
 
 attributetype ( AstAccountUserAgent
         NAME 'AstAccountUserAgent'
         DESC 'Asterisk account user context'
         EQUALITY caseIgnoreMatch
         SUBSTR caseIgnoreSubstringsMatch
         SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
 
 and patch fix_empty_attributes_1.6.1.4_v2.patch
 
 (closes issue ASTERISK-12921)
 Reported by: macogeek
 Patches:
       fix_empty_attributes_1.6.1.4_v2.patch uploaded by xvisor (license 863)
 Tested by: suretec
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=211768

By: Digium Subversion (svnbot) 2009-08-12 11:19:25

Repository: asterisk
Revision: 211775

_U  branches/1.6.1/
U   branches/1.6.1/contrib/scripts/asterisk.ldap-schema
U   branches/1.6.1/contrib/scripts/asterisk.ldif
U   branches/1.6.1/res/res_config_ldap.c

------------------------------------------------------------------------
r211775 | ghenry | 2009-08-12 11:19:24 -0500 (Wed, 12 Aug 2009) | 38 lines

Merged revisions 211767 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r211767 | ghenry | 2009-08-12 17:00:46 +0100 (Wed, 12 Aug 2009) | 33 lines
 
 Added three new attributes and applied a patch to res_config_ldap.c
 
 attributetype ( AstAccountSubscribeContext
         NAME 'AstAccountSubscribeContext'
         DESC 'Asterisk subscribe context'
         EQUALITY caseIgnoreMatch
         SUBSTR caseIgnoreSubstringsMatch
         SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
 
 attributetype ( AstAccountIpAddr
         NAME 'AstAccountIpAddr'
         DESC 'Asterisk aaccount IP address'
         EQUALITY caseIgnoreMatch
         SUBSTR caseIgnoreSubstringsMatch
         SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
 
 attributetype ( AstAccountUserAgent
         NAME 'AstAccountUserAgent'
         DESC 'Asterisk account user context'
         EQUALITY caseIgnoreMatch
         SUBSTR caseIgnoreSubstringsMatch
         SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
 
 and patch fix_empty_attributes_1.6.1.4_v2.patch
 
 (closes issue ASTERISK-12921)
 Reported by: macogeek
 Patches:
       fix_empty_attributes_1.6.1.4_v2.patch uploaded by xvisor (license 863)
 Tested by: suretec
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=211775

By: Digium Subversion (svnbot) 2009-08-12 11:22:17

Repository: asterisk
Revision: 211785

_U  branches/1.6.2/
U   branches/1.6.2/contrib/scripts/asterisk.ldap-schema
U   branches/1.6.2/contrib/scripts/asterisk.ldif
U   branches/1.6.2/res/res_config_ldap.c

------------------------------------------------------------------------
r211785 | ghenry | 2009-08-12 11:22:17 -0500 (Wed, 12 Aug 2009) | 38 lines

Merged revisions 211767 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
 r211767 | ghenry | 2009-08-12 17:00:46 +0100 (Wed, 12 Aug 2009) | 33 lines
 
 Added three new attributes and applied a patch to res_config_ldap.c
 
 attributetype ( AstAccountSubscribeContext
         NAME 'AstAccountSubscribeContext'
         DESC 'Asterisk subscribe context'
         EQUALITY caseIgnoreMatch
         SUBSTR caseIgnoreSubstringsMatch
         SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
 
 attributetype ( AstAccountIpAddr
         NAME 'AstAccountIpAddr'
         DESC 'Asterisk aaccount IP address'
         EQUALITY caseIgnoreMatch
         SUBSTR caseIgnoreSubstringsMatch
         SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
 
 attributetype ( AstAccountUserAgent
         NAME 'AstAccountUserAgent'
         DESC 'Asterisk account user context'
         EQUALITY caseIgnoreMatch
         SUBSTR caseIgnoreSubstringsMatch
         SYNTAX 1.3.6.1.4.1.1466.115.121.1.15)
 
 and patch fix_empty_attributes_1.6.1.4_v2.patch
 
 (closes issue ASTERISK-12921)
 Reported by: macogeek
 Patches:
       fix_empty_attributes_1.6.1.4_v2.patch uploaded by xvisor (license 863)
 Tested by: suretec
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=211785