Bug 208036 - security/courier-authlib-base - password change expect script does not work
Summary: security/courier-authlib-base - password change expect script does not work
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Guido Falsi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-15 18:07 UTC by jay-fbbu
Modified: 2017-07-19 11:51 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jay-fbbu 2016-03-15 18:07:30 UTC
I am using 10.2-RELEASE-p13 and we have a legacy e-mail system where user accounts are set up in /etc/password.   

After installing the courierpassd port, we could not get password changes to work.  After some investigation it turns out that the problem was within an expect script that the authdaemond program installed with courier-authlib-base uses.

courier-authlib-base installs an expect script that the authdaemon uses to change a user password:

/usr/local/libexec/courier-authlib/authsystem.passwd

Running the script manually demonstrates the problem:

[root@pe710 ~]# /usr/local/libexec/courier-authlib/authsystem.passwd
env: expect -f: No such file or directory

[root@pe710 ~]# head -1 /usr/local/libexec/courier-authlib/authsystem.passwd
#! /usr/bin/env expect -f


root@pe710 ~]# env expect -f
expect: option requires an argument -- f
usage: expect [-div] [-c cmds] [[-f] cmdfile] [args]
[root@pe710 ~]# 



Solution:  Removing the -f option to "expect" allows this script (and courierpassd) to work.


Here is what the failure looks like in ktrace:

44868 authdaemond GIO   fd 7 wrote 8 bytes
       "foo
        bar
       "
 44881 authdaemond RET   close 0
 44868 authdaemond RET   write 8
 44881 authdaemond CALL  openat(AT_FDCWD,0x800a31353,0x1<O_WRONLY>,<unused>0)
 44868 authdaemond CALL  close(0x7)
 44881 authdaemond NAMI  "/dev/null"
 44868 authdaemond RET   close 0
 44881 authdaemond RET   openat 1
 44868 authdaemond CALL  close(0x7)
 44881 authdaemond CALL  dup2(0x1,0x2)
 44868 authdaemond RET   close -1 errno 9 Bad file descriptor
 44881 authdaemond RET   dup2 2
 44868 authdaemond CALL  wait4(0xffffffff,0x7fffffffe02c,0,0)
 44881 authdaemond CALL  getuid
 44881 authdaemond RET   getuid 0
 44881 authdaemond CALL  setsid
 44881 authdaemond RET   setsid 44881/0xaf51
 44881 authdaemond CALL  setlogin(0x801c0d400)
 44881 authdaemond RET   setlogin 0
 44881 authdaemond CALL  setgid(0x64)
 44881 authdaemond RET   setgid 0
 44881 authdaemond CALL  getuid
 44881 authdaemond RET   getuid 0
 44881 authdaemond CALL  setgroups(0x1,0x7fffffffdfdc)
 44881 authdaemond RET   setgroups 0
 44881 authdaemond CALL  setuid(0x474)
 44881 authdaemond RET   setuid 0
 44881 authdaemond CALL  execve(0x800a31364,0x7fffffffe010,0x7fffffffeab0)
 44881 authdaemond NAMI  "/usr/local/libexec/courier-authlib/authsystem.passwd"
 44881 authdaemond NAMI  "/usr/bin/env"
 44881 authdaemond NAMI  "/libexec/ld-elf.so.1"
 44881 env      RET   execve 0
 44881 env      CALL  mmap(0,0x8000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,0xffffffff,0)
 44881 env      RET   mmap 34366156800/0x80061f000
 44881 env      CALL  issetugid
 44881 env      RET   issetugid 0
 44881 env      CALL  lstat(0x800623000,0x7fffffffd2a8)
 44881 env      NAMI  "/etc"
 44881 env      STRU  struct stat {dev=2190455046, ino=24, mode=040755, nlink=23, uid=0, gid=0, rdev=4294967295, atime=1457064003, stime=1458062741.296935914, ctime=1458062741.296935914, birthtime=1457063917.715644334, size=110, blksize=7680, blocks=17, flags=0x800 }
 44881 env      RET   lstat 0
 44881 env      CALL  lstat(0x800623000,0x7fffffffd2a8)
 44881 env      NAMI  "/etc/libmap.conf"
 44881 env      STRU  struct stat {dev=2190455046, ino=306131, mode=0100644, nlink=1, uid=0, gid=0, rdev=4294967295, atime=1457088188.705055586, stime=1457088188.705055586, ctime=1457088188.705055586, birthtime=1457088188.705055586, size=109, blksize=4096, blocks=9, flags=0x800 }
 44881 env      RET   lstat 0
 44881 env      CALL  openat(AT_FDCWD,0x800623000,0x100000<O_CLOEXEC>,<unused>0)
 44881 env      NAMI  "/etc/libmap.conf"
 44881 env      RET   openat 6
 44881 env      CALL  fstat(0x6,0x7fffffffdf60)
 44881 env      STRU  struct stat {dev=2190455046, ino=306131, mode=0100644, nlink=1, uid=0, gid=0, rdev=4294967295, atime=1457088188.705055586, stime=1457088188.705055586, ctime=1457088188.705055586, birthtime=1457088188.705055586, size=109, blksize=4096, blocks=9, flags=0x800 }
 44881 env      RET   fstat 0
 44881 env      CALL  mmap(0,0x6d,0x1<PROT_READ>,0x2<MAP_PRIVATE>,0x6,0)
 44881 env      RET   mmap 34366189568/0x800627000
 44881 env      CALL  close(0x6)
 44881 env      RET   close 0
 44881 env      CALL  lstat(0x800623800,0x7fffffffc638)
 44881 env      NAMI  "/usr"
 44881 env      STRU  struct stat {dev=2190455046, ino=26, mode=040755, nlink=16, uid=0, gid=0, rdev=4294967295, atime=1457064003, stime=1457303821.464661993, ctime=1457303821.464661993, birthtime=1457063917.716645041, size=16, blksize=4096, blocks=17, flags=0x800 }
 44881 env      RET   lstat 0
 44881 env      CALL  lstat(0x800623800,0x7fffffffc638)
 44881 env      NAMI  "/usr/local"
 44881 env      STRU  struct stat {dev=2190455046, ino=76, mode=040755, nlink=20, uid=0, gid=0, rdev=4294967295, atime=1457064003, stime=1457977479.199812788, ctime=1457977479.199812788, birthtime=1457063917.766644318, size=21, blksize=4096, blocks=17, flags=0x800 }
 44881 env      RET   lstat 0
 44881 env      CALL  lstat(0x800623800,0x7fffffffc638)
 44881 env      NAMI  "/usr/local/etc"
 44881 env      STRU  struct stat {dev=2190455046, ino=240163, mode=040755, nlink=23, uid=0, gid=0, rdev=4294967295, atime=1457079143.552595696, stime=1458060983.425057141, ctime=1458060983.425057141, birthtime=1457079143.552595696, size=68, blksize=4608, blocks=17, flags=0x800 }
 44881 env      RET   lstat 0
 44881 env      CALL  lstat(0x800623800,0x7fffffffc638)
 44881 env      NAMI  "/usr/local/etc/libmap.d"
 44881 env      RET   lstat -1 errno 2 No such file or directory
 44881 env      CALL  munmap(0x800627000,0x6d)
 44881 env      RET   munmap 0
 44881 env      CALL  openat(AT_FDCWD,0x800619713,0x100000<O_CLOEXEC>,<unused>0)
 44881 env      NAMI  "/var/run/ld-elf.so.hints"
 44881 env      RET   openat 6
 44881 env      CALL  read(0x6,0x7fffffffd798,0x80)
 44881 env      GIO   fd 6 read 128 bytes
       0x0000 4568 6e74 0100 0000 8000 0000 d100 0000 0000 0000 d000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000  |Ehnt....................................................................|
       0x0048 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000                                          |........................................................|

 44881 env      RET   read 128/0x80
 44881 env      CALL  lseek(0x6,0x80,SEEK_SET)
 44881 env      RET   lseek 128/0x80
 44881 env      CALL  read(0x6,0x800621300,0xd1)
 44881 env      GIO   fd 6 read 209 bytes
       "/lib:/usr/lib:/usr/lib/compat:/usr/local/lib:/usr/local/lib/compat:/usr/local/lib/courier-authlib:/usr/local/lib/dovecot:/usr/local/lib/gcc48:/usr/local/lib/libnet11:/usr/local/lib/mysql:/usr/local/llvm36/lib\0"
 44881 env      RET   read 209/0xd1
 44881 env      CALL  close(0x6)
 44881 env      RET   close 0
 44881 env      CALL  access(0x800623800,0<F_OK>)
 44881 env      NAMI  "/lib/libc.so.7"
 44881 env      RET   access 0
 44881 env      CALL  openat(AT_FDCWD,0x800620060,0x100000<O_CLOEXEC>,<unused>0)
 44881 env      NAMI  "/lib/libc.so.7"
 44881 env      RET   openat 6
 44881 env      CALL  fstat(0x6,0x7fffffffd870)
 44881 env      STRU  struct stat {dev=2190455046, ino=294944, mode=0100444, nlink=1, uid=0, gid=0, rdev=4294967295, atime=1457088085.806558584, stime=1457088085.811062921, ctime=1457088085.832276767, birthtime=1457088085.806558584, size=1642888, blksize=131072, blocks=2025, flags=0x20000 }
 44881 env      RET   fstat 0
 44881 env      CALL  mmap(0,0x1000,0x1<PROT_READ>,0x40002<MAP_PRIVATE|MAP_PREFAULT_READ>,0x6,0)
 44881 env      RET   mmap 34366189568/0x800627000
 44881 env      CALL  mmap(0,0x3ac000,0<PROT_NONE>,0x21002<MAP_PRIVATE|MAP_ANON|MAP_NOCORE>,0xffffffff,0)
 44881 env      RET   mmap 34368262144/0x800821000
 44881 env      CALL  mmap(0x800821000,0x176000,0x5<PROT_READ|PROT_EXEC>,0x60012<MAP_PRIVATE|MAP_FIXED|MAP_NOCORE|MAP_PREFAULT_READ>,0x6,0)
 44881 env      RET   mmap 34368262144/0x800821000
 44881 env      CALL  mmap(0x800b97000,0xc000,0x3<PROT_READ|PROT_WRITE>,0x40012<MAP_PRIVATE|MAP_FIXED|MAP_PREFAULT_READ>,0x6,0x176000)
 44881 env      RET   mmap 34371891200/0x800b97000
 44881 env      CALL  mmap(0x800ba3000,0x2a000,0x3<PROT_READ|PROT_WRITE>,0x1012<MAP_PRIVATE|MAP_FIXED|MAP_ANON>,0xffffffff,0)
 44881 env      RET   mmap 34371940352/0x800ba3000
 44881 env      CALL  munmap(0x800627000,0x1000)
 44881 env      RET   munmap 0
 44881 env      CALL  close(0x6)
 44881 env      RET   close 0
 44881 env      CALL  munmap(0x800626000,0x1000)
 44881 env      RET   munmap 0
 44881 env      CALL  mmap(0,0x19000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,0xffffffff,0)
 44881 env      RET   mmap 34366185472/0x800626000
 44881 env      CALL  sysarch(0x81,0x7fffffffe018)
 44881 env      RET   sysarch 0
 44881 env      CALL  sigprocmask(SIG_BLOCK,0x8008205f8,0x7fffffffdfd0)
 44881 env      RET   sigprocmask 0
 44881 env      CALL  sigprocmask(SIG_SETMASK,0x80082060c,0)
 44881 env      RET   sigprocmask 0
 44881 env      CALL  readlink(0x80096d97e,0x7fffffffd740,0x400)
 44881 env      NAMI  "/etc/malloc.conf"
 44881 env      RET   readlink -1 errno 2 No such file or directory
 44881 env      CALL  issetugid
 44881 env      RET   issetugid 0
 44881 env      CALL  mmap(0,0x400000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,0xffffffff,0)
 44881 env      RET   mmap 34372112384/0x800bcd000
 44881 env      CALL  munmap(0x800bcd000,0x400000)
 44881 env      RET   munmap 0
 44881 env      CALL  mmap(0,0x7ff000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,0xffffffff,0)
 44881 env      RET   mmap 34372112384/0x800bcd000
 44881 env      CALL  munmap(0x800bcd000,0x33000)
 44881 env      RET   munmap 0
 44881 env      CALL  munmap(0x801000000,0x3cc000)
 44881 env      RET   munmap 0
 44881 env      CALL  sigprocmask(SIG_BLOCK,0x8008205f8,0x7fffffffdb60)
 44881 env      RET   sigprocmask 0
 44881 env      CALL  sigprocmask(SIG_SETMASK,0x80082060c,0)
 44881 env      RET   sigprocmask 0
 44881 env      CALL  sigprocmask(SIG_BLOCK,0x8008205f8,0x7fffffffdb60)
 44881 env      RET   sigprocmask 0
 44881 env      CALL  sigprocmask(SIG_SETMASK,0x80082060c,0)
 44881 env      RET   sigprocmask 0
 44881 env      CALL  execve(0x7fffffffe580,0x7fffffffea98,0x7fffffffeab0)
 44881 env      NAMI  "/sbin/expect -f"
 44881 env      RET   execve -1 errno 2 No such file or directory
 44881 env      CALL  execve(0x7fffffffe580,0x7fffffffea98,0x7fffffffeab0)
 44881 env      NAMI  "/bin/expect -f"
 44881 env      RET   execve -1 errno 2 No such file or directory
 44881 env      CALL  execve(0x7fffffffe580,0x7fffffffea98,0x7fffffffeab0)
 44881 env      NAMI  "/usr/sbin/expect -f"
 44881 env      RET   execve -1 errno 2 No such file or directory
 44881 env      CALL  execve(0x7fffffffe580,0x7fffffffea98,0x7fffffffeab0)
 44881 env      NAMI  "/usr/bin/expect -f"
 44881 env      RET   execve -1 errno 2 No such file or directory
 44881 env      CALL  execve(0x7fffffffe580,0x7fffffffea98,0x7fffffffeab0)
 44881 env      NAMI  "/usr/games/expect -f"
 44881 env      RET   execve -1 errno 2 No such file or directory
 44881 env      CALL  execve(0x7fffffffe580,0x7fffffffea98,0x7fffffffeab0)
 44881 env      NAMI  "/usr/local/sbin/expect -f"
 44881 env      RET   execve -1 errno 2 No such file or directory
 44881 env      CALL  execve(0x7fffffffe580,0x7fffffffea98,0x7fffffffeab0)
 44881 env      NAMI  "/usr/local/bin/expect -f"
 44881 env      RET   execve -1 errno 2 No such file or directory
 44881 env      CALL  execve(0x7fffffffe580,0x7fffffffea98,0x7fffffffeab0)
 44881 env      NAMI  "/root/bin/expect -f"
 44881 env      RET   execve -1 errno 13 Permission denied
 44881 env      CALL  stat(0x7fffffffe580,0x7fffffffe500)
 44881 env      NAMI  "/root/bin/expect -f"
 44881 env      RET   stat -1 errno 13 Permission denied
 44881 env      CALL  write(0x2,0x7fffffffe350,0x5)
 44881 env      GIO   fd 2 wrote 5 bytes
       "env: "
 44881 env      RET   write 5
 44881 env      CALL  write(0x2,0x7fffffffe440,0x9)
 44881 env      GIO   fd 2 wrote 9 bytes
       "expect -f"
 44881 env      RET   write 9
 44881 env      CALL  write(0x2,0x800971918,0x2)
 44881 env      GIO   fd 2 wrote 2 bytes
       ": "
 44881 env      RET   write 2
 44881 env      CALL  mmap(0,0x400000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,0xffffffff,0)
 44881 env      RET   mmap 34376515584/0x801000000
 44881 env      CALL  stat(0x7fffffffe3f0,0x7fffffffe378)
 44881 env      NAMI  "/usr/share/nls/C/libc.cat"
 44881 env      RET   stat -1 errno 2 No such file or directory
 44881 env      CALL  stat(0x7fffffffe3f0,0x7fffffffe378)
 44881 env      NAMI  "/usr/share/nls/libc/C"
 44881 env      RET   stat -1 errno 2 No such file or directory
 44881 env      CALL  stat(0x7fffffffe3f0,0x7fffffffe378)
 44881 env      NAMI  "/usr/local/share/nls/C/libc.cat"
 44881 env      RET   stat -1 errno 2 No such file or directory
 44881 env      CALL  stat(0x7fffffffe3f0,0x7fffffffe378)
 44881 env      NAMI  "/usr/local/share/nls/libc/C"
 44881 env      RET   stat -1 errno 2 No such file or directory
 44881 env      CALL  madvise(0x801006000,0x1000,MADV_FREE)
 44881 env      RET   madvise 0
 44881 env      CALL  madvise(0x801007000,0x1000,MADV_FREE)
 44881 env      RET   madvise 0
 44881 env      CALL  write(0x2,0x7fffffffe350,0x1a)
 44881 env      GIO   fd 2 wrote 26 bytes
       "No such file or directory
       "
 44881 env      RET   write 26/0x1a
 44881 env      CALL  sigprocmask(SIG_BLOCK,0x8008205f8,0x7fffffffe710)
 44881 env      RET   sigprocmask 0
 44881 env      CALL  sigprocmask(SIG_SETMASK,0x80082060c,0)
 44881 env      RET   sigprocmask 0
 44881 env      CALL  sigprocmask(SIG_BLOCK,0x8008205f8,0x7fffffffe2a0)
 44881 env      RET   sigprocmask 0
 44881 env      CALL  sigprocmask(SIG_SETMASK,0x80082060c,0)
 44881 env      RET   sigprocmask 0
 44881 env      CALL  sigprocmask(SIG_BLOCK,0x8008205f8,0x7fffffffe2a0)
 44881 env      RET   sigprocmask 0
 44881 env      CALL  sigprocmask(SIG_SETMASK,0x80082060c,0)
 44881 env      RET   sigprocmask 0
 44881 env      CALL  exit(0x7f)
 44868 authdaemond CSW   stop kernel "wait"
 44868 authdaemond CSW   resume kernel "wait"
 44868 authdaemond RET   wait4 44881/0xaf51
 44868 authdaemond CALL  select(0x5,0,0x7fffffffdfb0,0,0x7fffffffdfa0)
 44868 authdaemond RET   select 1
 44868 authdaemond CALL  write(0x4,0x4047a1,0x5)
 44868 authdaemond GIO   fd 4 wrote 5 bytes
       "FAIL
       "
Comment 1 Guido Falsi freebsd_committer 2017-07-09 10:18:44 UTC
Taking this PR since I took maintainership oof the port.

I'm going to look at this in the near future.