# fss-0002
# Note: not compiling with: CFLAGS="$CFLAGS -fstack-protector"

main:
  if [[ $(grep -m 1 -o '^t_samba:[^:]*:' /etc/passwd) == "" ]] ; then adduser -l /bin/false -t target -g t_samba -n samba ; fi
  tkis_local_push program source3/
  sed -i -e "s|REPLACE_ROOT_USER_NAME|$root_user_name|g" auth/auth_util.c passdb/pdb_interface.c web/swat.c
  ./configure $CONF --disable-cups --without-smbwrapper --without-smbmount --with-quotas --without-python --with-readline --with-privatedir=/home/targets/samba/private --with-lockdir=/home/targets/samba/lock --with-swatdir=/home/targets/samba/swat --with-configdir=/home/targets/samba/settings --with-logfilebase=/home/targets/samba/logs --with-aio-support --with-piddir=/var/run/samba --with-logfilebase=/var/log/samba --with-cifsumount --with-pthreads --enable-relro --enable-gnutls --with-sqlite3 
  sed -i -e 's|\-ltalloc|-L./bin/ &|g' Makefile
  make 
  make install
  chmod oug-x /include/libsmbclient.h
  mv -v /include/libsmbclient.h ${TC}include/
  cp -v ${PR}smb.conf /home/targets/samba/settings/
  sed -i -e "s|REPLACE_ROOT_USER_NAME|$root_user_name|g" /home/targets/samba/settings/smb.conf
  chgrp t_samba -R /sbin/{nmbd,smbd,swat,winbindd}
  if [[ -e /lib/libmsrpc.so ]] ; then chgrp samba /lib/libmsrpc.so* ]] ; fi
  chgrp e_samba -R /sbin/{,u}mount.cifs /lib/{charset,{low,up}case.dat,valid.dat,auth} /bin/{findsmb,net,nmblookup,ntlm_auth,pdbedit,profiles,rpcclient,smbcacls,smbcontrol,smbcquotas,smbget,smbpasswd,smbstatus,smbtar,smbtree,smbspool,tdbbackup,tdbdump,tdbtool,testparm,wbinfo,eventlogadm,smbclient} /lib/vfs /home/targets/samba /lib/lib{wbclient,tdb,talloc,netapi}.so*
  chgrp e_samba -R /bin/ldb{add,del,rename,edit,modify,search} /lib/libsmb{client,sharemodes}.so* /bin/sharesec
  chgrp e_samba -R /lib/gpext /lib/perfcount
  chown $root_user_name:u_$root_user_name -R /home/targets/samba/{lock,private}
  rm -Rf /lib/{de,en,fi,fr,it,ja,nl,pl,tr,ru}.msg /lib/{rpc,pdb,nss_info,idmap,libsngeclient.a} /include
