ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
and copied libnss_adam.so to /etc/lib
after that I edited /etc/nsswitch.conf and set:
passwd: adam files
shadow: adam files
Now, when I try to use su or ssh, it seem that my library doesn’t work (I don’t see my log lines) and I just get user is not exists message.
I also know that winbind (for example) are doing exactly what I did.
which created a symlink in /usr/lib for me, automagically. Note that it also tells the linker to refresh its cache.
After putting passwd: adamwhatever.. in /etc/nsswitch.conf my functions did get called.
I believe you have omitted some necessary flags while compiling, and have forgotten to tell the linker (ldconfig) that you have installed a new library. You can install inotify-tools, and run sudo inotifywatch -m /lib/libnss_adam.so.2 to see if the library is read (used) when you test, say id -u nominalanimal , which definitely uses the passwd service.
Aside from the above, I am a bit sceptical whether it makes any sense writing an NSS module in C++. All NSS libraries I've looked at were written in pure C; perhaps you too might consider your choice of language. My main concern is that since the NSS library is loaded as part of each program using name services, the C++ libraries might cause unwanted side effects in non-C++ programs.
/usr/bin/ld: /tmp/ccOlpcx7.o: relocation R_X86_64_32 against `a local symbol' cannot be used when making a shared object; recompile with -fPIC
/tmp/ccOlpcx7.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
after I tried to compile it.
Can u help me with this?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.