On Fri, Jun 17, 2022 at 12:39:30AM +0000, Hamid Maadani wrote: > > You need to read the mongodb documentation with care and make sure > > that you honour their API contract. For example: > > > > mongoc_init(): > > When it comes to 'mongoc_init' and 'mongoc_clean', they are supposed to be > run once per process. > If I understand how postfix works correctly, it invokes 'dict_mongodb_open' > when it loads the shared-object for the dict (postfix-mongodb.so).
No, this is invoked once per mongodb table. > I did not > Find an init function for the dict libraries, just the open method. > That would mean that mongoc_init would be run every time that library is > opened (which should be once for postmap and proxymap, unsure about postfix > master). You need to use a static variable to record whether you've already initialised the library, and do it just once. No need to worry about threads or locks. Postfix is single-threaded. > Please let me know if my understanding is incorrect. > Would it be preferred to move this to postfix master process instead of a > loadable > module? Even if the user does not want to use Mongo? No. That can't work. > I guess that's a difference in our way of thinking. Personally, it would be > easier for me > this way, but if you see more value in failing in case both are specified, > that's easy to > implement. Just let me know. I think that's better in this case. > Question about using variables in main.cf I'm getting 'unused > parameter' errors for my mongo variables, where I know I am using > them. Is there something I need to do in the module to mark a > variable as used while reading it from the config? See "src/postconf/" for how this is handled for LDAP, ... > Just Fyi, when compiling postfix, I keep running into <stdio.h> missing from > src/posttls-finger/posttls-finger.c > Adding the stdio header resolves the issue, easy fix. Feel free to post a patch. I don't see this on FreeBSD or MacOS. What platform are you building on? -- Viktor.