First of all, happy new year.
I'm particularly interested for the passwd binary from the shadow package :
Code: Select all
$ ls -al /usr/bin/passwd
-rwsr-xr-x 1 root root 63736 Jul 27 2018 /usr/bin/passwd
Here is my exhaustive edit / recompile procedure :
Code: Select all
$ apt-get source shadow/stable
$ apt-get build-dep shadow
$ cd shadow-4.5
$ export QUILT_PATCHES=debian/patches
$ export QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"
$ quilt push -a
$ quilt new xxx_test_patch
$ quilt add lib/commonio.c
$ quilt add lib/defines.h
$ sed -i 's/\/etc\/passwd/\/etc\/test\/passwd/g' lib/defines.h
$ sed -i 's/\/etc\/group/\/etc\/test\/group/g' lib/defines.h
$ sed -i 's/\/etc\/shadow/\/etc\/test\/shadow/g' lib/defines.h
$ sed -i 's/\/etc\/gshadow/\/etc\/test\/gshadow/g' lib/defines.h
$ quilt refresh
$ quilt pop -a
$ dch --local test
$ debuild -b -uc -us
I have my patch which appears in the
shadow-4.5/debian/patches/ directory as well as in the
shadow-4.5/debian/patches/series file.
However, when I extract the binaries from the .deb I get the same binary as the original :
Code: Select all
$ cd ..
$ dpkg --extract passwd_4.5-1.1test1_amd64.deb .
$ ls -al ./usr/bin/passwd
-rwsr-xr-x 1 debian debian 63736 Jan 1 10:20 ./usr/bin/passwd
Normally, the password change should be done in the
/etc/test directory and not
/etc/ (confirming the path via strace).
Code: Select all
$ sudo chown root: ./usr/bin/passwd
$ sudo ./usr/bin/passwd user_test
New password:
Retype new password:
passwd: password updated successfully
It works perfectly when it shouldn't.
Whereas, if I don't go through quilt and compile without debuild, it works :
Code: Select all
$ apt-get source shadow/stable
$ apt-get build-dep shadow
$ cd shadow-4.5
$ sed -i 's/\/etc\/passwd/\/etc\/test\/passwd/g' lib/defines.h
$ sed -i 's/\/etc\/group/\/etc\/test\/group/g' lib/defines.h
$ sed -i 's/\/etc\/shadow/\/etc\/test\/shadow/g' lib/defines.h
$ sed -i 's/\/etc\/gshadow/\/etc\/test\/gshadow/g' lib/defines.h
$ autogen.sh
$ make
$ sudo ./src/passwd user_test
Changing password for user_test
Enter the new password (minimum of 5 characters)
Please use a combination of upper and lower case letters and numbers.
New password:
Re-enter new password:
passwd: /etc/test/passwd.1276: No such file or directory
passwd: cannot lock /etc/test/passwd; try again later.
But I don't think it compiles with the same build options, I really need the exact debian package with just my changes.
I'm sorry for the length of the post but I had to be as descriptive as possible.