Hi,
I use OpenLDAP C API for my LDAP client library and also OpenLDAP server
for my tests (both of version 2.4.7). I am now working on unsolicited
notification support. My code looks like this:
.
.
.
struct timeval to;
to.tv_sec = waitTime;
to.tv_usec = 0;
LDAPMessage *res = NULL;
SW_CHAR *retOid = NULL;
//
// Check the notification
//
SW_INT32 rc = ldap_result(m_ldap, LDAP_RES_ANY, 1, &to, &res);
.
.
.
My problem is that I always get timeout result code and NULL response
message. To simulate the unsolicited notification, I use a retcode
overlay with this configuration:
overlay retcode
retcode-parent "ou=Example Codes,dc=example,dc=com"
retcode-item "cn=Unsolicited" 0x00 unsolicited="0"
retcode-item "cn=Notice of Disconnect" 0x00
unsolicited="1.3.6.1.4.1.1466.20036"
To invoke it, I invoke search operation on "cn=Notice of
Disconnect,ou=Example Codes,dc=example,dc=com". In slapd.log file, I can
see something like this:
conn=2 op=1 SRCH base="cn=Notice of Disconnect,ou=Example
Codes,dc=example,dc=com" scope=0 deref=0 filter="(objectClass=*)"
conn=2 op=1 SRCH attr=objectclass
send_ldap_extended: err=0 oid=1.3.6.1.4.1.1466.20036 len=0
send_ldap_response: msgid=0 tag=120 err=0
ber_flush2: 38 bytes to sd 12
0000: 30 24 02 01 00 78 1f 0a 01 00 04 00 04 00 8a 16
0$...x..........
0010: 31 2e 33 2e 36 2e 31 2e 34 2e 31 2e 31 34 36 36
1.3.6.1.4.1.1466
0020: 2e 32 30 30 33 36 .20036
ldap_write: want=38, written=38
0000: 30 24 02 01 00 78 1f 0a 01 00 04 00 04 00 8a 16
0$...x..........
0010: 31 2e 33 2e 36 2e 31 2e 34 2e 31 2e 31 34 36 36
1.3.6.1.4.1.1466
0020: 2e 32 30 30 33 36 .20036
conn=2 op=1 RESULT oid=1.3.6.1.4.1.1466.20036 err=0 text=
daemon: activity on 1 descriptor
daemon: activity on: 12r
daemon: read activity on 12
daemon: select: listen=7 active_threads=0 tvp=NULL
connection_get(12)
connection_get(12): got connid=2
connection_read(12): checking for input on id=2
ber_get_next
ldap_read: want=8, got=7
0000: 30 05 02 01 03 42 00 0....B.
ber_get_next: tag 0x30 len 5 contents:
ber_dump: buf=1005d4290 ptr=1005d4290 end=1005d4295 len=5
0000: 02 01 03 42 00 ...B.
ber_get_next
ldap_read: want=8, got=0
This looks like the server sent the notification. However, in my client
library, I can't get it.
Can anyone help? Do I have wrong client code or is the problem in the
way how I try to invoke the notification? I would appreciate any help.
Regards,
Tomas