[Pkg-shadow-devel] patch for compilation with libtcb

Serge Hallyn serge.hallyn at ubuntu.com
Thu Sep 4 20:13:51 UTC 2014


Quoting J (j at dawnrazor.net):
> hello,
> 
> the shadow.src.userdel.c.diff patch attached was necessary for
> compilation of shadow-4.2.1 against libtcb - a used-but-not-defined
> buflen variable. a couple trailing spaces were caught in the diff.
> I also found that the autostuff-generated Makefile under src/ was
> broken. this doesn't particularly apply to my case so I've no
> incentive to dig through the autostuff and try to see what's
> breaking there - just passing along the change I had to make for the
> reference of whomever may have such incentive. that, obviously, is
> the shadow.src.Makefile.diff patch.
> 
> thanks.
> J

> --- src/userdel.c.orig	Mon Sep  1 14:21:35 2014
> +++ src/userdel.c	Mon Sep  1 14:21:35 2014
> @@ -921,9 +921,11 @@
>  }
>  
>  #ifdef WITH_TCB
> +#define BUFLEN 4096
>  static int remove_tcbdir (const char *user_name, uid_t user_id)
>  {
>  	char *buf;
> +	int buflen = BUFLEN;

It seems like it would be nicer to do

	size_t buflen = strlen(TCB_DIR) + strlen(user_name) + 2;
	buf = alloca(buflen);

>  	int ret = 0;
>  	size_t bufsize = (sizeof TCB_DIR) + strlen (user_name) + 2;
>  
> @@ -1012,7 +1014,7 @@
>  			{NULL, 0, NULL, '\0'}
>  		};
>  		while ((c = getopt_long (argc, argv,
> -#ifdef WITH_SELINUX             
> +#ifdef WITH_SELINUX
>  		                         "fhrR:Z",
>  #else				/* !WITH_SELINUX */
>  		                         "fhrR:",
> @@ -1030,7 +1032,7 @@
>  				break;
>  			case 'R': /* no-op, handled in process_root_flag () */
>  				break;
> -#ifdef WITH_SELINUX             
> +#ifdef WITH_SELINUX
>  			case 'Z':
>  				if (is_selinux_enabled () > 0) {
>  					Zflg = true;

> --- src/Makefile.orig	2014-08-14 12:02:45.813381626 +0000
> +++ src/Makefile	2014-08-14 12:03:22.498313620 +0000
> @@ -505,7 +505,7 @@
>  	-I$(top_srcdir)/libmisc
>  
>  suidbins = su
> -suidubins = chage chfn chsh expiry gpasswd newgrp passwd newuidmap newgidmap
> +suidubins = chage chfn chsh expiry gpasswd newgrp newuidmap newgidmap
>  shadowsgidubins = passwd
>  LDADD = $(INTLLIBS) \
>  		 $(LIBTCB) \
> @@ -1217,8 +1217,6 @@
>  
>  	suidubins += chage chgpasswd chpasswd groupadd groupdel groupmod newusers useradd userdel usermod
>  
> -suidubins -= passwd

In the Makefile.am this is represented as

if WITH_TCB
suidubins -= passwd
shadowsgidubins = passwd
endif

So if this breaks for you, it might be better to do

suidubins = chage chfn chsh expiry gpasswd newgrp newuidmap newgidmap
if !WITH_TCB
suidubins += passwd
else
shadowsgidubins = passwd
endif

> -
>  install-am: all-am
>  	$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
>  	ln -sf newgrp	$(DESTDIR)$(ubindir)/sg

> _______________________________________________
> Pkg-shadow-devel mailing list
> Pkg-shadow-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-shadow-devel




More information about the Pkg-shadow-devel mailing list