public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
* Need help with adding a new service to nsswitch.conf
@ 2022-06-14 14:56 Pranjal Goswami
  2022-06-15  5:51 ` Florian Weimer
  0 siblings, 1 reply; 5+ messages in thread
From: Pranjal Goswami @ 2022-06-14 14:56 UTC (permalink / raw)
  To: libc-help

Hi Friends ,
I am looking at adding another service in nsswitch.conf which can look for
user presence in a file other than /etc/password. I have copied the files
from nss_files  to a new folder and I  have made the changes in the
Makefile  under nss to get my module to build.. However I get an error when
I try  to build glibc.
/../include/libc-symbols.h:34:32: warning: "MODULE_libnss_secmgr" is not
defined, evaluates to 0 [-Wundef]
   34 | #define IN_MODULE  PASTE_NAME (MODULE_, MODULE_NAME)
      |                                ^~~~~~~
./../include/libc-symbols.h:32:26: note: in definition of macro
'PASTE_NAME1'
   32 | #define PASTE_NAME1(a,b) a##b
      |                          ^
./../include/libc-symbols.h:34:20: note: in expansion of macro 'PASTE_NAME'
   34 | #define IN_MODULE  PASTE_NAME (MODULE_, MODULE_NAME)

secmgr is the module that I am adding. I suspect that the problem is
related to the  line NSS_DECLARE_MODULE_FUNCTIONS (secmgr).
So if we are adding a new service under nss , what additional things we
need to do besides adding a module under nss and having teh same set of
files as in nss/files - renamed to the  new service that that  am using?


Thanks!

Pranjal

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Need help with adding a new service to nsswitch.conf
  2022-06-14 14:56 Need help with adding a new service to nsswitch.conf Pranjal Goswami
@ 2022-06-15  5:51 ` Florian Weimer
  2022-06-15  7:03   ` Pranjal Goswami
  0 siblings, 1 reply; 5+ messages in thread
From: Florian Weimer @ 2022-06-15  5:51 UTC (permalink / raw)
  To: Pranjal Goswami via Libc-help; +Cc: Pranjal Goswami

* Pranjal Goswami via Libc-help:

> Hi Friends ,
> I am looking at adding another service in nsswitch.conf which can look for
> user presence in a file other than /etc/password. I have copied the files
> from nss_files  to a new folder and I  have made the changes in the
> Makefile  under nss to get my module to build.. However I get an error when
> I try  to build glibc.
> /../include/libc-symbols.h:34:32: warning: "MODULE_libnss_secmgr" is not
> defined, evaluates to 0 [-Wundef]
>    34 | #define IN_MODULE  PASTE_NAME (MODULE_, MODULE_NAME)
>       |                                ^~~~~~~
> ./../include/libc-symbols.h:32:26: note: in definition of macro
> 'PASTE_NAME1'
>    32 | #define PASTE_NAME1(a,b) a##b
>       |                          ^
> ./../include/libc-symbols.h:34:20: note: in expansion of macro 'PASTE_NAME'
>    34 | #define IN_MODULE  PASTE_NAME (MODULE_, MODULE_NAME)
>
> secmgr is the module that I am adding. I suspect that the problem is
> related to the  line NSS_DECLARE_MODULE_FUNCTIONS (secmgr).
> So if we are adding a new service under nss , what additional things we
> need to do besides adding a module under nss and having teh same set of
> files as in nss/files - renamed to the  new service that that  am using?

Is there a reason why you need to build your NSS module under the glibc
build system?  <nss.h> is an installed header file, and you can use
NSS_DECLARE_MODULE_FUNCTIONS (secmgr) to get declarations for all the
recognized plug-in functions.

Thanks,
Florian


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Need help with adding a new service to nsswitch.conf
  2022-06-15  5:51 ` Florian Weimer
@ 2022-06-15  7:03   ` Pranjal Goswami
  2022-06-15  7:07     ` Florian Weimer
  0 siblings, 1 reply; 5+ messages in thread
From: Pranjal Goswami @ 2022-06-15  7:03 UTC (permalink / raw)
  To: Florian Weimer; +Cc: Pranjal Goswami via Libc-help

I see. So we have an option of building my own NSS module outside the glibc
build system , referencing <nss.h> and using  NSS_DECLARE_MODULE_FUNCTIONS
(secmgr) to get to the  declarations for the plug-in functions. So it means
that for writing a new module, we need <nss.h> and
NSS_DECLARE_MODULE_FUNCTIONS (secmgr)  only. There are no other changes to
be done within the nss folder ?

Regards
Pranjal

On Wed, Jun 15, 2022 at 11:21 AM Florian Weimer <fweimer@redhat.com> wrote:

> * Pranjal Goswami via Libc-help:
>
> > Hi Friends ,
> > I am looking at adding another service in nsswitch.conf which can look
> for
> > user presence in a file other than /etc/password. I have copied the files
> > from nss_files  to a new folder and I  have made the changes in the
> > Makefile  under nss to get my module to build.. However I get an error
> when
> > I try  to build glibc.
> > /../include/libc-symbols.h:34:32: warning: "MODULE_libnss_secmgr" is not
> > defined, evaluates to 0 [-Wundef]
> >    34 | #define IN_MODULE  PASTE_NAME (MODULE_, MODULE_NAME)
> >       |                                ^~~~~~~
> > ./../include/libc-symbols.h:32:26: note: in definition of macro
> > 'PASTE_NAME1'
> >    32 | #define PASTE_NAME1(a,b) a##b
> >       |                          ^
> > ./../include/libc-symbols.h:34:20: note: in expansion of macro
> 'PASTE_NAME'
> >    34 | #define IN_MODULE  PASTE_NAME (MODULE_, MODULE_NAME)
> >
> > secmgr is the module that I am adding. I suspect that the problem is
> > related to the  line NSS_DECLARE_MODULE_FUNCTIONS (secmgr).
> > So if we are adding a new service under nss , what additional things we
> > need to do besides adding a module under nss and having teh same set of
> > files as in nss/files - renamed to the  new service that that  am using?
>
> Is there a reason why you need to build your NSS module under the glibc
> build system?  <nss.h> is an installed header file, and you can use
> NSS_DECLARE_MODULE_FUNCTIONS (secmgr) to get declarations for all the
> recognized plug-in functions.
>
> Thanks,
> Florian
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Need help with adding a new service to nsswitch.conf
  2022-06-15  7:03   ` Pranjal Goswami
@ 2022-06-15  7:07     ` Florian Weimer
  2022-06-15  9:58       ` Pranjal Goswami
  0 siblings, 1 reply; 5+ messages in thread
From: Florian Weimer @ 2022-06-15  7:07 UTC (permalink / raw)
  To: Pranjal Goswami; +Cc: Pranjal Goswami via Libc-help

* Pranjal Goswami:

> I see. So we have an option of building my own NSS module outside the
> glibc build system , referencing <nss.h> and using
> NSS_DECLARE_MODULE_FUNCTIONS (secmgr) to get to the declarations for
> the plug-in functions. So it means that for writing a new module, we
> need <nss.h> and NSS_DECLARE_MODULE_FUNCTIONS (secmgr) only. There are
> no other changes to be done within the nss folder ?

With “nss folder”, do you mean the ”nss” subdirectory in the glibc
source tree?  You should not have to deal with the glibc sources at all,
you can build your NSS module separately.

Thanks,
Florian


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Need help with adding a new service to nsswitch.conf
  2022-06-15  7:07     ` Florian Weimer
@ 2022-06-15  9:58       ` Pranjal Goswami
  0 siblings, 0 replies; 5+ messages in thread
From: Pranjal Goswami @ 2022-06-15  9:58 UTC (permalink / raw)
  To: Florian Weimer; +Cc: Pranjal Goswami via Libc-help

Yes , by nss folder  I meant the nss subdirectory in glibc . I will  give
it a try  to build my nss module separately. Thanks for the guidance.!
Regards
Pranjal

On Wed, Jun 15, 2022 at 12:37 PM Florian Weimer <fweimer@redhat.com> wrote:

> * Pranjal Goswami:
>
> > I see. So we have an option of building my own NSS module outside the
> > glibc build system , referencing <nss.h> and using
> > NSS_DECLARE_MODULE_FUNCTIONS (secmgr) to get to the declarations for
> > the plug-in functions. So it means that for writing a new module, we
> > need <nss.h> and NSS_DECLARE_MODULE_FUNCTIONS (secmgr) only. There are
> > no other changes to be done within the nss folder ?
>
> With “nss folder”, do you mean the ”nss” subdirectory in the glibc
> source tree?  You should not have to deal with the glibc sources at all,
> you can build your NSS module separately.
>
> Thanks,
> Florian
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-06-15  9:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-14 14:56 Need help with adding a new service to nsswitch.conf Pranjal Goswami
2022-06-15  5:51 ` Florian Weimer
2022-06-15  7:03   ` Pranjal Goswami
2022-06-15  7:07     ` Florian Weimer
2022-06-15  9:58       ` Pranjal Goswami

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).