Re: PAM authentication patch - v2

Derek Robert Price <[email protected]>
Newsgroups gmane.comp.version-control.cvs.bugs
Organization Ximbiot <http://ximbiot.com>
Message-ID <[email protected]>
Brian Murphy wrote:

> Derek Robert Price wrote:
>
>> Hrm.  Can we get $PROG (see src/sanity.sh) in here?  This is the 
>> program prefix defined by configure + the string `cvs'.  This is the 
>> actual name of the CVS executable since the user can set it at 
>> configure time.  It shouldn't be hard to use AC_DEFINE_UNQUOTED to 
>> define PAM_SERVICENAME to the correct string once you figure which 
>> shell variable configure is storing the value in.
>
> src/sanity.sh seems to get called with the name "cvs"
>
> brm@brian:~/cvs/cvs/src$ grep sanity.sh Makefile
>        sanity.sh
>        $(SHELL) $(srcdir)/sanity.sh `pwd`/cvs
>        $(SHELL) $(srcdir)/sanity.sh -r `pwd`/cvs
>
> the prefix (name mangling) specified at configuration time is only 
> carried out
> when we install with this lovely bit of code:
>
> install-binPROGRAMS: $(bin_PROGRAMS)
>        @$(NORMAL_INSTALL)
>        $(mkinstalldirs) $(DESTDIR)$(bindir)
>        @list='$(bin_PROGRAMS)'; for p in $$list; do \
>          p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
>          if test -f $$p \
>          ; then \
>            f=`echo "$$p1" | sed 
> 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
>           echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p 
> $(DESTDIR)$(bindir)/$$f"; \
>           $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p 
> $(DESTDIR)$(bindir)/$$f; \
>          else :; fi; \
>         done
>
> I especially like the bit with sed. This means that at the moment 
> there is no variable
> which contains the name of the executable as it will be when installed.


That makes sense.  install has to change the name of all installed 
programs and this avoids having configure rewrite all the program name 
definitions in the makefilse.

You should be able to duplicate the functionality with

    progname=`echo cvs |sed "$program_transform_name"`
    AC_DEFINE_UNQUOTED([PROGNAME],$progname)

in configure.in, as long as this comes after the invocation of 
AC_ARG_PROGRAM.

You might also use the global program_name variable defined in 
src/main.c, instead.  Then, when a user used a soft link called "mycvs" 
or a script was run which used exec to call CVS, program_name would be 
what the user (perhaps the administrator) set it to.  I'm not sure 
whether that's a good thing when dealing with PAM or not, though I 
suspect it might not be.  From src/main.c:

> #ifdef ARGV0_NOT_PROGRAM_NAME
>     /* On some systems, e.g. VMS, argv[0] is not the name of the command
>        which the user types to invoke the program.  */
>     program_name = "cvs";
> #else
>     program_name = last_component (argv[0]);
> #endif


Derek

-- 
                *8^)

Email: [email protected]

Get CVS support at <http://ximbiot.com>!
-- 
I will not fake seizures.
I will not fake seizures.
I will not fake seizures...

          - Bart Simpson on chalkboard, _The Simpsons_
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.