Hello,
I am trying to understand how the sock overlay works. I'am partly successfull in getting the entries, so the unix socket is working. What I want to do, is acting as a trigger each time an entry is added I receive the data, but I don't know how to say; "that's OK add it" to mdm backend I just answer "RESULT\n"; So the ldapadd is considered successfull, but in fact no entry is added. Is there a way to do that? I have some difficulties to understand the way it works Thanks
Dom
Lalot Dominique wrote:
Hello,
I am trying to understand how the sock overlay works. I'am partly successfull in getting the entries, so the unix socket is working. What I want to do, is acting as a trigger each time an entry is added I receive the data, but I don't know how to say; "that's OK add it" to mdm backend I just answer "RESULT\n"; So the ldapadd is considered successfull, but in fact no entry is added. Is there a way to do that? I have some difficulties to understand the way it works
Re-read slapd-sock(5) manpage, paragraph "When used as an overlay"
Thanks
Dom
Hello Howard
I've red this manpage quite a lot. Also trying to find somewhere documentations about overlay interfaces, but without any success I've also red the code. I don't understand how to say doit..
Here is my perl code, doing nothing..
#!/usr/bin/perl use IO::Socket::UNIX;
my $socket_path = '/tmp/mysocket'; unlink $socket_path if -e $socket_path;
my $socket = IO::Socket::UNIX->new( Local => $socket_path, Type => SOCK_STREAM, # Type => SOCK_DGRAM, Listen => SOMAXCONN, );
die "Can't create socket: $!" unless $socket; while (1) { next unless my $connection = $socket->accept; if (fork() == 0) { $connection->autoflush(1); while (<$connection>) { #chomp($line); print ; next if /^ADD$/; next if /^msgid:/; next if /^suffix:/; print $connection $_; last if /^$/; }
print $connection "CONTINUE\n"; exit; } }
And here is a BUG, in back-sock/result.c It goes here only once at the end of the ldif, but never after..
/* line marked the end of an entry or result */ if ( *line == '\n' ) { Debug( LDAP_DEBUG_ANY, "TRACE1 \n", 0, 0, 0 ); if ( strncasecmp( buf, "RESULT", 6 ) == 0 ) { break; } Debug( LDAP_DEBUG_ANY, "TRACE2 buf=%s\n",buf, 0, 0 ); if ( strncasecmp( buf, "CONTINUE", 8 ) == 0 ) { Debug( LDAP_DEBUG_ANY, "TRACE3\n", 0, 0, 0 ); struct sockinfo *si = (struct sockinfo *) op->o_bd->be_private; /* Only valid when operating as an overlay! */ assert( si->si_ops != 0 ); rs->sr_err = SLAP_CB_CONTINUE; goto skip; } So I just put if ( strncasecmp( buf, "CONTINUE", 8 ) == 0 ) outside of if ( *line == '\n' ) { and it works.. I am no more a C specialist (1985 last time) so I don't know how to patch
Hope this helps other people, or if I'm wrong please correct me
Thanks
Dom
2015-06-23 18:22 GMT+02:00 Howard Chu hyc@symas.com:
Lalot Dominique wrote:
Hello,
I am trying to understand how the sock overlay works. I'am partly successfull in getting the entries, so the unix socket is working. What I want to do, is acting as a trigger each time an entry is added I receive the data, but I don't know how to say; "that's OK add it" to mdm backend I just answer "RESULT\n"; So the ldapadd is considered successfull, but in fact no entry is added. Is there a way to do that? I have some difficulties to understand the way it works
Re-read slapd-sock(5) manpage, paragraph "When used as an overlay"
Thanks
Dom
-- -- Howard Chu CTO, Symas Corp. http://www.symas.com Director, Highland Sun http://highlandsun.com/hyc/ Chief Architect, OpenLDAP http://www.openldap.org/project/
Lalot Dominique wrote:
Hello Howard
I've red this manpage quite a lot. Also trying to find somewhere documentations about overlay interfaces, but without any success I've also red the code. I don't understand how to say doit..
servers/slapd/overlays/slapover.txt
And here is a BUG, in back-sock/result.c It goes here only once at the end of the ldif, but never after..
/* line marked the end of an entry or result */ if ( *line == '\n' ) { Debug( LDAP_DEBUG_ANY, "TRACE1 \n", 0, 0, 0 ); if ( strncasecmp( buf, "RESULT", 6 ) == 0 ) { break; } Debug( LDAP_DEBUG_ANY, "TRACE2 buf=%s\n",buf, 0, 0 ); if ( strncasecmp( buf, "CONTINUE", 8 ) == 0 ) { Debug( LDAP_DEBUG_ANY, "TRACE3\n", 0, 0, 0 ); struct sockinfo *si = (struct sockinfo *) op->o_bd->be_private; /* Only valid when operating as an overlay! */ assert( si->si_ops != 0 ); rs->sr_err = SLAP_CB_CONTINUE; goto skip; }
So I just put if ( strncasecmp( buf, "CONTINUE", 8 ) == 0 ) outside of if ( *line == '\n' ) { and it works.. I am no more a C specialist (1985 last time) so I don't know how to patch
Hope this helps other people, or if I'm wrong please correct me
Looks like you hit ITS#8048. This was already fixed back in February.
Hum, my version is 2.4.40, so that's the last version. Is there a mistake somewhere? Thanks
Dom
2015-06-24 21:33 GMT+02:00 Howard Chu hyc@symas.com:
Lalot Dominique wrote:
Hello Howard
I've red this manpage quite a lot. Also trying to find somewhere documentations about overlay interfaces, but without any success I've also red the code. I don't understand how to say doit..
servers/slapd/overlays/slapover.txt
And here is a BUG, in back-sock/result.c
It goes here only once at the end of the ldif, but never after..
/* line marked the end of an entry or result */ if ( *line == '\n' ) { Debug( LDAP_DEBUG_ANY, "TRACE1 \n", 0, 0, 0 ); if ( strncasecmp( buf, "RESULT", 6 ) == 0 ) { break; } Debug( LDAP_DEBUG_ANY, "TRACE2 buf=%s\n",buf, 0, 0 ); if ( strncasecmp( buf, "CONTINUE", 8 ) == 0 ) { Debug( LDAP_DEBUG_ANY, "TRACE3\n", 0, 0, 0 ); struct sockinfo *si = (struct sockinfo *)
op->o_bd->be_private; /* Only valid when operating as an overlay! */ assert( si->si_ops != 0 ); rs->sr_err = SLAP_CB_CONTINUE; goto skip; } So I just put if ( strncasecmp( buf, "CONTINUE", 8 ) == 0 ) outside of if ( *line == '\n' ) { and it works.. I am no more a C specialist (1985 last time) so I don't know how to patch
Hope this helps other people, or if I'm wrong please correct me
Looks like you hit ITS#8048. This was already fixed back in February.
-- -- Howard Chu CTO, Symas Corp. http://www.symas.com Director, Highland Sun http://highlandsun.com/hyc/ Chief Architect, OpenLDAP http://www.openldap.org/project/
Lalot Dominique wrote:
Hum, my version is 2.4.40, so that's the last version. Is there a mistake somewhere?
Looking at [1] ITS#8048 was fixed for release 2.4.41 (tagged in git) but not officially packaged in a tar.gz yet.
Ciao, Michael.
[1] https://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=CHANGES;h=...
Michael Ströder wrote:
Lalot Dominique wrote:
Hum, my version is 2.4.40, so that's the last version. Is there a mistake somewhere?
Looking at [1] ITS#8048 was fixed for release 2.4.41 (tagged in git) but not officially packaged in a tar.gz yet.
CONTINUE is not properly documented:
http://www.openldap.org/its/index.cgi?findid=8171
In my noop_logger back-sock listener I always return CONTINUE\n\n which works the first time. But from the second time until forever the data cannot be fully transmitted and Python raises exception error: [Errno 32] Broken pipe.
Can anybody confirm what exactly should be returned in this case?
[ ] CONTINUE [ ] CONTINUE\n [ ] CONTINUE\n\n
Ciao, Michael.
Michael Ströder wrote:
Michael Ströder wrote:
Lalot Dominique wrote:
Hum, my version is 2.4.40, so that's the last version. Is there a mistake somewhere?
Looking at [1] ITS#8048 was fixed for release 2.4.41 (tagged in git) but not officially packaged in a tar.gz yet.
CONTINUE is not properly documented:
http://www.openldap.org/its/index.cgi?findid=8171
In my noop_logger back-sock listener I always return CONTINUE\n\n which works the first time. But from the second time until forever the data cannot be fully transmitted and Python raises exception error: [Errno 32] Broken pipe.
Can anybody confirm what exactly should be returned in this case?
[ ] CONTINUE [ ] CONTINUE\n [ ] CONTINUE\n\n
I have some doubts that ITS#8048 was properly fixed. When restarting slapd the first couple of returned CONTINUE\n\n simply work. But after ~ 4-6 responses it seems slapd closes the socket too early.
Ciao, Michael.
Michael Ströder wrote:
Michael Ströder wrote:
Michael Ströder wrote:
Lalot Dominique wrote:
Hum, my version is 2.4.40, so that's the last version. Is there a mistake somewhere?
Looking at [1] ITS#8048 was fixed for release 2.4.41 (tagged in git) but not officially packaged in a tar.gz yet.
CONTINUE is not properly documented:
http://www.openldap.org/its/index.cgi?findid=8171
In my noop_logger back-sock listener I always return CONTINUE\n\n which works the first time. But from the second time until forever the data cannot be fully transmitted and Python raises exception error: [Errno 32] Broken pipe.
Can anybody confirm what exactly should be returned in this case?
[ ] CONTINUE [ ] CONTINUE\n [ ] CONTINUE\n\n
I have some doubts that ITS#8048 was properly fixed. When restarting slapd the first couple of returned CONTINUE\n\n simply work. But after ~ 4-6 responses it seems slapd closes the socket too early.
Everything seems to work ok for:
sockops bind unbind search compare modify modrdn add delete
But I have the issues with:
sockresps result search
Any difference regarding results to be returned to sockops and sockresps? Maybe I'm overlooking something in slapd-sock(5) but I cannot find a description what to the external listener should return in case of RESULT and ENTRY.
Ciao, Michael.
Michael Ströder wrote:
Michael Ströder wrote:
Lalot Dominique wrote:
Hum, my version is 2.4.40, so that's the last version. Is there a mistake somewhere?
Looking at [1] ITS#8048 was fixed for release 2.4.41 (tagged in git) but not officially packaged in a tar.gz yet.
CONTINUE is not properly documented:
http://www.openldap.org/its/index.cgi?findid=8171
In my noop_logger back-sock listener I always return CONTINUE\n\n which works the first time. But from the second time until forever the data cannot be fully transmitted and Python raises exception error: [Errno 32] Broken pipe.
Can anybody confirm what exactly should be returned in this case?
[ ] CONTINUE [x] CONTINUE\n [ ] CONTINUE\n\n
Howard Chu wrote:
Michael Ströder wrote:
Michael Ströder wrote:
Lalot Dominique wrote:
Hum, my version is 2.4.40, so that's the last version. Is there a mistake somewhere?
Looking at [1] ITS#8048 was fixed for release 2.4.41 (tagged in git) but not officially packaged in a tar.gz yet.
CONTINUE is not properly documented:
http://www.openldap.org/its/index.cgi?findid=8171
In my noop_logger back-sock listener I always return CONTINUE\n\n which works the first time. But from the second time until forever the data cannot be fully transmitted and Python raises exception error: [Errno 32] Broken pipe.
Can anybody confirm what exactly should be returned in this case?
[ ] CONTINUE [x] CONTINUE\n [ ] CONTINUE\n\n
Btw, here is the example I use to test overlay functionality.
openldap-technical@openldap.org