dbaarda / LightLdapd

Tiny LDAP server exporting NSS databases using PAM authentication.
GNU General Public License v3.0
2 stars 1 forks source link

Code does not compile because of typo #17

Closed TomiBelan closed 11 months ago

TomiBelan commented 11 months ago

Hi. Neat project. I wanted to try it, but it doesn't compile. Your most recent pushed commit (6da594614bb384f97c9305b9680d65bf84f1b9ea from 4 Jul 2021) had a typo and broke the build. Here is a patch.

diff --git a/ldap_server.c b/ldap_server.c
index cd11e4b..dd44dd5 100644
--- a/ldap_server.c
+++ b/ldap_server.c
@@ -493,7 +493,7 @@ void ldap_request_abandon(ldap_connection *connection, LDAPMessage_t *msg)
     lcinfo(connection, "%ld:%s abandon request", msg->messageID, LDAPMessage_name(msg));
     /* Consume the message like we do for other request types. */
     LDAPMessage_free(msg);
-    for (ldap_request r = connection->request; r; r = ldap_request_next(&connection->request, r))
+    for (ldap_request *r = connection->request; r; r = ldap_request_next(&connection->request, r))
         if (r->message->messageID == msgid)
             return ldap_request_free(r);
 }
The error ``` cc -Wall -Wextra -Wno-unused-parameter -DNDEBUG -Iasn1/ -o lightldapd main.c ldap_server.c nss2ldap.c pam.c ssl.c ranges.c log.c asn1/LDAP.a -lev -lpam -lmbedtls -lmbedx509 -lmbedcrypto -lcrypt ldap_server.c: In function ‘sighup_cb’: ldap_server.c:246:18: warning: unused variable ‘server’ [-Wunused-variable] 246 | ldap_server *server = watcher->data; | ^~~~~~ ldap_server.c: In function ‘ldap_request_abandon’: ldap_server.c:496:27: error: invalid initializer 496 | for (ldap_request r = connection->request; r; r = ldap_request_next(&connection->request, r)) | ^~~~~~~~~~ ldap_server.c:496:48: error: used struct type value where scalar is required 496 | for (ldap_request r = connection->request; r; r = ldap_request_next(&connection->request, r)) | ^ ldap_server.c:496:95: error: incompatible type for argument 2 of ‘ldap_request_next’ 496 | for (ldap_request r = connection->request; r; r = ldap_request_next(&connection->request, r)) | ^ | | | ldap_request In file included from ldap_server.h:99, from ldap_server.c:8: dlist.h:69:51: note: expected ‘ldap_request *’ but argument is of type ‘ldap_request’ 69 | static inline ENTRY *ENTRY_next(ENTRY **l, ENTRY *e) ldap_server.c:497:14: error: invalid type argument of ‘->’ (have ‘ldap_request’) 497 | if (r->message->messageID == msgid) | ^~ ldap_server.c:498:38: error: incompatible type for argument 1 of ‘ldap_request_free’ 498 | return ldap_request_free(r); | ^ | | | ldap_request ldap_server.c:418:38: note: expected ‘ldap_request *’ but argument is of type ‘ldap_request’ 418 | void ldap_request_free(ldap_request *request) | ~~~~~~~~~~~~~~^~~~~~~ ldap_server.c:498:20: warning: ‘return’ with a value, in function returning void [-Wreturn-type] 498 | return ldap_request_free(r); | ^~~~~~~~~~~~~~~~~ ldap_server.c:487:6: note: declared here 487 | void ldap_request_abandon(ldap_connection *connection, LDAPMessage_t *msg) | ^~~~~~~~~~~~~~~~~~~~ make[2]: *** [Makefile:16: lightldapd] Error 1 ```
dbaarda commented 11 months ago

Err... sorry about that. I haven't worked on this for a while, but I thought I'd left it in a fully working state.

I now have to figure out what I was last doing with it...

Thanks for the bug and fix.

dbaarda commented 11 months ago

For the record, I'm pretty embarrassed about this. Normally I'm really meticulous about avoiding broken commits, and would never leave a project busted like this. I would like to think the code quality is generally much better than that.

I think I committed that last fix as the final step of making the signal handling more robust and clean, and I was getting pretty damn confident it was all working well and somehow (still not sure how) I missed that before the commit. The only think I can think is maybe I bumped delete in my visual code inspection after running it just before the commit.

TomiBelan commented 11 months ago

I know that feeling. Please don't beat yourself up about it. ❤️

Thanks for the prompt fix! I wish other (much more active) projects responded to my bug reports this quickly.