diff options
Diffstat (limited to 'source3/script')
27 files changed, 1158 insertions, 65 deletions
diff --git a/source3/script/.cvsignore b/source3/script/.cvsignore new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/source3/script/.cvsignore diff --git a/source3/script/addtosmbpass b/source3/script/addtosmbpass index 42af518397..bc82851c52 100644 --- a/source3/script/addtosmbpass +++ b/source3/script/addtosmbpass @@ -41,18 +41,18 @@ BEGIN { { print $0; for(name in names) { - if($1 ~ name) { + if($1 == name) { delete names[name]; } } } END { fmt = "%s:%s:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:"; - fmt = fmt "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:%s:%s:%s\n"; + fmt = fmt "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:[U ]:LCT-00000000:%s:\n"; for(name in names) { while ((getline < pwdf) > 0) { if ($1 == name) { - printf(fmt, $1, $3, $5, $6, $7); + printf(fmt, $1, $3, $5); close(pwdf); notfound = ""; break; @@ -65,7 +65,7 @@ END { command = ypmatch " " name " passwd"; command | getline; if (NF > 0) { - printf(fmt, $1, $3, $5, $6, $7); + printf(fmt, $1, $3, $5); } close(command); } diff --git a/source3/script/build_env.sh b/source3/script/build_env.sh new file mode 100755 index 0000000000..0000759f16 --- /dev/null +++ b/source3/script/build_env.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +uname=`uname -a` +date=`date` +srcdir=$1 +builddir=$2 +compiler=$3 + + if [ ! "x$USER" = "x" ]; then + whoami=$USER + else + if [ ! "x$LOGNAME" = "x" ]; then + whoami=$LOGNAME + else + whoami=`whoami || id -un` + fi + fi + +host=`hostname` + +cat <<EOF +/* This file is automatically generated with "make build_env". DO NOT EDIT */ + +#ifndef _BUILD_ENV_H +#define _BUILD_ENV_H + +#define BUILD_ENV_UNAME "${uname}" +#define BUILD_ENV_DATE "${date}" +#define BUILD_ENV_SRCDIR "${srcdir}" +#define BUILD_ENV_BUILDDIR "${builddir}" +#define BUILD_ENV_USER "${whoami}" +#define BUILD_ENV_HOST "${host}" +#define BUILD_ENV_COMPILER "${compiler}" +#endif /* _BUILD_ENV_H */ +EOF diff --git a/source3/script/convert_smbpasswd b/source3/script/convert_smbpasswd new file mode 100755 index 0000000000..edb775d3a6 --- /dev/null +++ b/source3/script/convert_smbpasswd @@ -0,0 +1,17 @@ +#!/bin/sh +# +# Convert a Samba 1.9.18 smbpasswd file format into +# a Samba 2.0 smbpasswd file format. +# Read from stdin and write to stdout for simplicity. +# Set the last change time to 0x363F96AD to avoid problems +# with trying to work out how to get the seconds since 1970 +# in awk or the shell. JRA. +# +nawk 'BEGIN {FS=":"} +{ + if( $0 ~ "^#" ) { + print $0 + } else { + printf( "%s:%s:%s:%s:[U ]:LCT-363F96AD:\n", $1, $2, $3, $4); + } +}' diff --git a/source3/script/extract_allparms.sh b/source3/script/extract_allparms.sh new file mode 100755 index 0000000000..f16068b3fd --- /dev/null +++ b/source3/script/extract_allparms.sh @@ -0,0 +1,2 @@ +#!/bin/sh +grep '{".*P_[GL]' param/loadparm.c | sed -e 's/&.*$//g' -e 's/",.*P_LOCAL.*$/ S/' -e 's/",.*P_GLOBAL.*$/ G/' -e 's/^ .*{"//g' | sort -f diff --git a/source3/script/installbin.sh b/source3/script/installbin.sh index 633e6cb5bb..c2f34082dd 100755 --- a/source3/script/installbin.sh +++ b/source3/script/installbin.sh @@ -1,4 +1,5 @@ #!/bin/sh + INSTALLPERMS=$1 BASEDIR=$2 BINDIR=$3 @@ -10,33 +11,30 @@ shift shift shift -for d in $BASEDIR $BINDIR $LIBDIR $VARDIR; do -if [ ! -d $d ]; then -mkdir $d -if [ ! -d $d ]; then - echo Failed to make directory $d - exit 1 -fi -fi -done - - for p in $*; do - echo Installing $p as $BINDIR/$p - if [ -f $BINDIR/$p ]; then - mv $BINDIR/$p $BINDIR/$p.old + p2=`basename $p` + echo Installing $p as $BINDIR/$p2 + if [ -f $BINDIR/$p2 ]; then + rm -f $BINDIR/$p2.old + mv $BINDIR/$p2 $BINDIR/$p2.old + fi + cp $p $BINDIR/ + chmod $INSTALLPERMS $BINDIR/$p2 + + # this is a special case, mount needs this in a specific location + if [ $p2 = smbmount ]; then + ln -sf $BINDIR/$p2 /sbin/mount.smbfs fi - cp $p $BINDIR/$p - chmod $INSTALLPERMS $BINDIR/$p done cat << EOF ====================================================================== The binaries are installed. You may restore the old binaries (if there -were any) using the command "make revert" +were any) using the command "make revert". You may uninstall the binaries +using the command "make uninstallbin" or "make uninstall" to uninstall +binaries, man pages and shell scripts. ====================================================================== EOF exit 0 - diff --git a/source3/script/installcp.sh b/source3/script/installcp.sh new file mode 100755 index 0000000000..d0c5bf8ecc --- /dev/null +++ b/source3/script/installcp.sh @@ -0,0 +1,44 @@ +#!/bin/sh +srcdir=$1 +LIBDIR=$2 +CODEPAGEDIR=$3 +BINDIR=$4 + +shift +shift +shift +shift + +echo Installing codepage files in $CODEPAGEDIR +for d in $LIBDIR $CODEPAGEDIR; do +if [ ! -d $d ]; then +mkdir $d +if [ ! -d $d ]; then + echo Failed to make directory $d + exit 1 +fi +fi +done + +for p in $*; do + if [ -f ${srcdir}/codepages/codepage_def.$p ]; then + echo Creating codepage file $CODEPAGEDIR/codepage.$p + $BINDIR/make_smbcodepage c $p ${srcdir}/codepages/codepage_def.$p $CODEPAGEDIR/codepage.$p + fi + if [ -f ${srcdir}/codepages/CP${p}.TXT ]; then + echo Creating unicode map $CODEPAGEDIR/unicode_map.$p + $BINDIR/make_unicodemap $p ${srcdir}/codepages/CP${p}.TXT $CODEPAGEDIR/unicode_map.$p + fi +done + + +cat << EOF +====================================================================== +The code pages have been installed. You may uninstall them using the +command "make uninstallcp" or make "uninstall" to uninstall binaries, +man pages, shell scripts and code pages. +====================================================================== +EOF + +exit 0 + diff --git a/source3/script/installdat.sh b/source3/script/installdat.sh new file mode 100755 index 0000000000..7ff88ac788 --- /dev/null +++ b/source3/script/installdat.sh @@ -0,0 +1,23 @@ +#!/bin/sh +#fist version March 2002, Herb Lewis + +DATDIR=$1 +SRCDIR=$2/ + +echo Installing dat files in $DATDIR + +for f in $SRCDIR/codepages/*.dat; do + FNAME=$DATDIR/`basename $f` + echo $FNAME + cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges? + chmod 0644 $FNAME +done + +cat << EOF +====================================================================== +The dat files have been installed. +====================================================================== +EOF + +exit 0 + diff --git a/source3/script/installdirs.sh b/source3/script/installdirs.sh new file mode 100755 index 0000000000..dd8f7cd19c --- /dev/null +++ b/source3/script/installdirs.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +BASEDIR=$1 +SBINDIR=$2 +BINDIR=$3 +LIBDIR=$4 +VARDIR=$5 +PRIVATEDIR=$6 + +for d in $BASEDIR $SBINDIR $BINDIR $LIBDIR $VARDIR $PRIVATEDIR; do +if [ ! -d $d ]; then +mkdir $d +if [ ! -d $d ]; then + echo Failed to make directory $d + exit 1 +fi +fi +done + + diff --git a/source3/script/installman.sh b/source3/script/installman.sh index a79d157c5f..2329ed5425 100755 --- a/source3/script/installman.sh +++ b/source3/script/installman.sh @@ -1,35 +1,71 @@ #!/bin/sh -MANDIR=$1 -SRCDIR=$2 +#5 July 96 Dan.Shearer@unisa.edu.au removed hardcoded values +# +# 13 Aug 2001 Rafal Szczesniak <mimir@spin.ict.pwr.wroc.pl> +# modified to accomodate international man pages (inspired +# by Japanese edition's approach) -echo Installing man pages in $MANDIR +MANDIR=$1 +SRCDIR=$2/ +langs=$3 -for d in $MANDIR $MANDIR/man1 $MANDIR/man5 $MANDIR/man7 $MANDIR/man8; do -if [ ! -d $d ]; then -mkdir $d -if [ ! -d $d ]; then - echo Failed to make directory $d - exit 1 -fi +if [ $# -ge 4 ] ; then + GROFF=$4 # sh cmd line, including options fi + + +for lang in $langs; do + if [ "X$lang" = Xen ]; then + echo Installing default man pages in $MANDIR/ + lang=. + else + echo Installing \"$lang\" man pages in $MANDIR/lang/$lang + fi + + langdir=$MANDIR/lang/$lang + for d in $MANDIR $MANDIR/lang $langdir $langdir/man1 $langdir/man5 $langdir/man7 $langdir/man8; do + if [ ! -d $d ]; then + mkdir $d + if [ ! -d $d ]; then + echo Failed to make directory $d, does $USER have privileges? + exit 1 + fi + fi + done + + for sect in 1 5 7 8 ; do + for m in $langdir/man$sect ; do + for s in $SRCDIR../docs/manpages/$lang/*$sect; do + FNAME=$m/`basename $s` + + # Test for writability. Involves + # blowing away existing files. + + if (rm -f $FNAME && touch $FNAME); then + rm $FNAME + if [ "x$GROFF" = x ] ; then + cp $s $m # Copy raw nroff + else + echo "\t$FNAME" # groff'ing can be slow, give the user + # a warm fuzzy. + $GROFF $s > $FNAME # Process nroff, because man(1) (on + # this system) doesn't . + fi + chmod 0644 $FNAME + else + echo Cannot create $FNAME... does $USER have privileges? + fi + done + done + done done +cat << EOF +====================================================================== +The man pages have been installed. You may uninstall them using the command +the command "make uninstallman" or make "uninstall" to uninstall binaries, +man pages and shell scripts. +====================================================================== +EOF -cp $SRCDIR../docs/*.1 $MANDIR/man1 -cp $SRCDIR../docs/*.5 $MANDIR/man5 -cp $SRCDIR../docs/*.8 $MANDIR/man8 -cp $SRCDIR../docs/*.7 $MANDIR/man7 -echo Setting permissions on man pages -chmod 0644 $MANDIR/man1/smbstatus.1 -chmod 0644 $MANDIR/man1/smbclient.1 -chmod 0644 $MANDIR/man1/smbrun.1 -chmod 0644 $MANDIR/man1/testparm.1 -chmod 0644 $MANDIR/man1/testprns.1 -chmod 0644 $MANDIR/man1/smbtar.1 -chmod 0644 $MANDIR/man5/smb.conf.5 -chmod 0644 $MANDIR/man7/samba.7 -chmod 0644 $MANDIR/man8/smbd.8 -chmod 0644 $MANDIR/man8/nmbd.8 - -echo Man pages installed exit 0 diff --git a/source3/script/installscripts.sh b/source3/script/installscripts.sh new file mode 100755 index 0000000000..bff5423e7c --- /dev/null +++ b/source3/script/installscripts.sh @@ -0,0 +1,47 @@ +#!/bin/sh +# this script courtesy of James_K._Foote.PARC@xerox.com +# 5 July 96 Dan.Shearer@UniSA.Edu.Au Don't hardcode script names, get from Make + +INSTALLPERMS=$1 +BINDIR=$2 + +shift +shift + +echo Installing scripts in $BINDIR + +for d in $BINDIR; do + if [ ! -d $d ]; then + mkdir $d + if [ ! -d $d ]; then + echo Failed to make directory $d + echo Have you run installbin first? + exit 1 + fi + fi +done + +for p in $*; do + p2=`basename $p` + echo Installing $BINDIR/$p2 + if [ -f $BINDIR/$p2 ]; then + rm -f $BINDIR/$p2.old + mv $BINDIR/$p2 $BINDIR/$p2.old + fi + cp $p $BINDIR/ + chmod $INSTALLPERMS $BINDIR/$p2 + if [ ! -f $BINDIR/$p2 ]; then + echo Cannot copy $p2... does $USER have privileges? + fi +done + +cat << EOF +====================================================================== +The scripts have been installed. You may uninstall them using +the command "make uninstallscripts" or "make install" to install binaries, +man pages and shell scripts. You may recover the previous version (if any +by "make revert". +====================================================================== +EOF + +exit 0 diff --git a/source3/script/installswat.sh b/source3/script/installswat.sh new file mode 100755 index 0000000000..c66604cdb8 --- /dev/null +++ b/source3/script/installswat.sh @@ -0,0 +1,127 @@ +#!/bin/sh +#fist version March 1998, Andrew Tridgell + +SWATDIR=$1 +SRCDIR=$2/ +BOOKDIR=$SWATDIR/using_samba + +echo Installing SWAT in $SWATDIR +echo Installing the Samba Web Administration Tool + +LANGS=". `cd $SRCDIR../swat/; /bin/echo lang/??`" +echo Installing langs are `cd $SRCDIR../swat/lang/; /bin/echo ??` + +for ln in $LANGS; do + SWATLANGDIR=$SWATDIR/$ln + for d in $SWATLANGDIR $SWATLANGDIR/help $SWATLANGDIR/images \ + $SWATLANGDIR/include; do + if [ ! -d $d ]; then + mkdir -p $d + if [ ! -d $d ]; then + echo Failed to make directory $d, does $USER have privileges? + exit 1 + fi + fi + done +done + +# Install images +for ln in $LANGS; do + +for f in $SRCDIR../swat/$ln/images/*.gif; do + FNAME=$SWATDIR/$ln/images/`basename $f` + echo $FNAME + cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges? + chmod 0644 $FNAME +done + +# Install html help + +for f in $SRCDIR../swat/$ln/help/*.html; do + FNAME=$SWATDIR/$ln/help/`basename $f` + echo $FNAME + if [ "x$BOOKDIR" = "x" ]; then + cat $f | sed 's/@BOOKDIR@.*$//' > $f.tmp + else + cat $f | sed 's/@BOOKDIR@//' > $f.tmp + fi + f=$f.tmp + cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges? + rm -f $f + chmod 0644 $FNAME +done + +# Install html documentation + +for f in $SRCDIR../docs/htmldocs/*.html; do + FNAME=$SWATDIR/help/`basename $f` + echo $FNAME + cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges? + chmod 0644 $FNAME +done + +# Install "server-side" includes + +for f in $SRCDIR../swat/$ln/include/*.html; do + FNAME=$SWATDIR/$ln/include/`basename $f` + echo $FNAME + cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges? + chmod 0644 $FNAME +done + +done + +# Install Using Samba book + +if [ "x$BOOKDIR" != "x" ]; then + + # Create directories + + for d in $BOOKDIR $BOOKDIR/figs $BOOKDIR/gifs; do + if [ ! -d $d ]; then + mkdir $d + if [ ! -d $d ]; then + echo Failed to make directory $d, does $USER have privileges? + exit 1 + fi + fi + done + + # HTML files + + for f in $SRCDIR../docs/htmldocs/using_samba/*.html; do + FNAME=$BOOKDIR/`basename $f` + echo $FNAME + cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges? + chmod 0644 $FNAME + done + + # Figures + + for f in $SRCDIR../docs/htmldocs/using_samba/figs/*.gif; do + FNAME=$BOOKDIR/figs/`basename $f` + echo $FNAME + cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges? + chmod 0644 $FNAME + done + + # Gifs + + for f in $SRCDIR../docs/htmldocs/using_samba/gifs/*.gif; do + FNAME=$BOOKDIR/gifs/`basename $f` + echo $FNAME + cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges? + chmod 0644 $FNAME + done + +fi + +cat << EOF +====================================================================== +The SWAT files have been installed. Remember to read the swat/README +for information on enabling and using SWAT +====================================================================== +EOF + +exit 0 + diff --git a/source3/script/makeunicodecasemap.awk b/source3/script/makeunicodecasemap.awk new file mode 100644 index 0000000000..8424b6c672 --- /dev/null +++ b/source3/script/makeunicodecasemap.awk @@ -0,0 +1,59 @@ +function reset_vals() { + upperstr = ""; + lowerstr = ""; + flagstr = "0"; +} + +function print_val() { + upperstr = $13; + lowerstr = $14; + if ( upperstr == "" ) + upperstr = strval; + if ( lowerstr == "" ) + lowerstr = strval; + + if ( $3 == "Lu" ) + flagstr = sprintf("%s|%s", flagstr, "UNI_UPPER"); + if ( $3 == "Ll" ) + flagstr = sprintf("%s|%s", flagstr, "UNI_LOWER"); + if ( val >= 48 && val <= 57) + flagstr = sprintf("%s|%s", flagstr, "UNI_DIGIT"); + if ((val >= 48 && val <= 57) || (val >= 65 && val <= 70) || (val >=97 && val <= 102)) + flagstr = sprintf("%s|%s", flagstr, "UNI_XDIGIT"); + if ( val == 32 || (val >=9 && val <= 13)) + flagstr = sprintf("%s|%s", flagstr, "UNI_SPACE"); + if( index(flagstr, "0|") == 1) + flagstr = substr(flagstr, 3, length(flagstr) - 2); + printf("{ 0x%s, 0x%s, %s }, \t\t\t/* %s %s */\n", lowerstr, upperstr, flagstr, strval, $2); + val++; + strval=sprintf("%04X", val); + reset_vals(); +} + +BEGIN { + val=0 + FS=";" + strval=sprintf("%04X", val); + reset_vals(); +} + +{ + if ( $1 == strval ) { + print_val(); + } else { + while ( $1 != strval) { + printf("{ 0x%04X, 0x%04X, 0 }, \t\t\t/* %s NOMAP */\n", val, val, strval); + val++; + strval=sprintf("%04X", val); + } + print_val(); + } +} + +END { + while ( val < 65536 ) { + printf("{ 0x%04X, 0x%04X, 0 }, \t\t\t/* %s NOMAP */\n", val, val, strval); + val++; + strval=sprintf("%04X", val); + } +} diff --git a/source3/script/makeyodldocs.sh b/source3/script/makeyodldocs.sh new file mode 100755 index 0000000000..5b54df033e --- /dev/null +++ b/source3/script/makeyodldocs.sh @@ -0,0 +1,92 @@ +#!/bin/sh +SRCDIR=$1 +shift +FILES=$@ + +if test -z $FILES; then + FILES=*.yo +fi + +YODLDIR=$SRCDIR/../docs/yodldocs +MANPAGEDIR=$SRCDIR/../docs/manpages +HTMLDIR=$SRCDIR/../docs/htmldocs + +echo "Re-creating man pages and HTML pages from YODL sources..." + +if [ ! -d $MANPAGEDIR ]; then + echo "directory $MANPAGEDIR does not exist, are we in the right place?" + exit 1 +fi + +if [ ! -d $HTMLDIR ]; then + echo "directory $HTMLDIR does not exist, are we in the right place?" + exit 1 +fi + +if [ ! -d $YODLDIR ]; then + echo "directory $YODLDIR does not exist, are we in the right place?" + exit 1 +fi + +cd $YODLDIR + +for d in $FILES +do + +# +# Create the basename from the YODL manpage +# + bn=`echo $d | sed -e 's/\.yo//'` + + case "$d" + in + *.[0-9].yo) + echo "Creating man pages..." + echo $d + rm -f $bn.man + yodl2man $d + if [ ! -f $bn.man ]; then + echo "Failed to make man page for $d" + exit 1 + fi + cp $bn.man ../manpages/$bn || echo "Cannot create $YODLDIR/../manpages/$bn" + rm -f $bn.man + + echo "Creating html versions of man pages..." + echo $d + rm -f $bn.html + yodl2html $d + if [ ! -f $bn.html ]; then + echo "Failed to make html page for $d" + exit 1 + fi + cp $bn.html ../htmldocs || echo "Cannot create $YODLDIR/../htmldocs/$bn.html" + rm -f $bn.html + ;; + *) +# +# Non man-page YODL docs - just make html and text. +# + echo $d + rm -f $bn.html + yodl2html $d + if [ ! -f $bn.html ]; then + echo "Failed to make html page for $d" + exit 1 + fi + cp $bn.html ../htmldocs || echo "Cannot create $YODLDIR/../htmldocs/$bn.html" + rm -f $bn.html + rm -f $bn.txt + yodl2txt $d + if [ ! -f $bn.txt ]; then + echo "Failed to make text page for $d" + exit 1 + fi + cp $bn.txt ../textdocs || echo "Cannot create $YODLDIR/../textdocs/$bn.txt" + rm -f $bn.txt + ;; + esac +done + +echo "Remember to CVS check in your changes..." +exit 0 diff --git a/source3/script/mkinstalldirs b/source3/script/mkinstalldirs new file mode 100755 index 0000000000..f945dbf2bc --- /dev/null +++ b/source3/script/mkinstalldirs @@ -0,0 +1,38 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman <friedman@prep.ai.mit.edu> +# Created: 1993-05-16 +# Public domain + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" 1>&2 + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/source3/script/mknissmbpasswd.sh b/source3/script/mknissmbpasswd.sh new file mode 100755 index 0000000000..a94c963bdc --- /dev/null +++ b/source3/script/mknissmbpasswd.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# +# Copyright (C) 1998 Benny Holmgren +# +# Script to import smbpasswd file into the smbpasswd NIS+ table. Reads +# from stdin the smbpasswd file. +# +while true +do + read row + if [ -z "$row" ] + then + break + fi + + if [ "`echo $row | cut -c1`" = "#" ] + then + continue + fi + + nistbladm -a \ + name=\"`echo $row | cut -d: -f1`\" \ + uid=\"`echo $row | cut -d: -f2`\" \ + lmpwd=\"`echo $row | cut -d: -f3`\" \ + ntpwd=\"`echo $row | cut -d: -f4`\" \ + acb=\"`echo $row | cut -d: -f5`\" \ + pwdlset_t=\"`echo $row | cut -d: -f6`\" \ + gcos=\"`echo $row | cut -d: -f7`\" \ + home=\"`echo $row | cut -d: -f8`\" \ + shell=\"`echo $row | cut -d: -f9`\" smbpasswd.org_dir.`nisdefaults -d` +done diff --git a/source3/script/mknissmbpwdtbl.sh b/source3/script/mknissmbpwdtbl.sh new file mode 100755 index 0000000000..a9b34ff9a7 --- /dev/null +++ b/source3/script/mknissmbpwdtbl.sh @@ -0,0 +1,42 @@ +#!/bin/sh +# +# Copyright (C) 1998 Benny Holmgren +# +# Creates smbpasswd table and smb group in NIS+ +# + +nistbladm \ + -D access=og=rmcd,nw= -c \ + -s : smbpasswd_tbl \ + name=S,nogw=r \ + uid=S,nogw=r \ + user_rid=S,nogw=r \ + smb_grpid=,nw+r \ + group_rid=,nw+r \ + acb=,nw+r \ + \ + lmpwd=C,nw=,g=r,o=rm \ + ntpwd=C,nw=,g=r,o=rm \ + \ + logon_t=,nw+r \ + logoff_t=,nw+r \ + kick_t=,nw+r \ + pwdlset_t=,nw+r \ + pwdlchg_t=,nw+r \ + pwdmchg_t=,nw+r \ + \ + full_name=,nw+r \ + home_dir=,nw+r \ + dir_drive=,nw+r \ + logon_script=,nw+r \ + profile_path=,nw+r \ + acct_desc=,nw+r \ + workstations=,nw+r \ + \ + hours=,nw+r \ + smbpasswd.org_dir.`nisdefaults -d` + +nisgrpadm -c smb.`nisdefaults -d` + +nischgrp smb.`nisdefaults -d` smbpasswd.org_dir.`nisdefaults -d` + diff --git a/source3/script/mkproto.awk b/source3/script/mkproto.awk new file mode 100644 index 0000000000..9b0aa360bc --- /dev/null +++ b/source3/script/mkproto.awk @@ -0,0 +1,155 @@ +BEGIN { + inheader=0; +# use_ldap_define = 0; + current_file=""; + if (headername=="") { + headername="_PROTO_H_"; + } + + print "#ifndef",headername + print "#define",headername + print "" + print "/* This file is automatically generated with \"make proto\". DO NOT EDIT */" + print "" +} + +END { + print "" + print "#endif /* ",headername," */" +} + +{ + if (FILENAME!=current_file) { +# if (use_ldap_define) +# { +# print "#endif /* USE_LDAP */" +# use_ldap_define = 0; +# } + print "" + print "/* The following definitions come from",FILENAME," */" + print "" + current_file=FILENAME + } + if (inheader) { + if (match($0,"[)][ \t]*$")) { + inheader = 0; + printf "%s;\n",$0; + } else { + printf "%s\n",$0; + } + next; + } +} + +# special handling for code merge of TNG to head +/^#define OLD_NTDOMAIN 1/ { + printf "#if OLD_NTDOMAIN\n" +} +/^#undef OLD_NTDOMAIN/ { + printf "#endif\n" +} +/^#define NEW_NTDOMAIN 1/ { + printf "#if NEW_NTDOMAIN\n" +} +/^#undef NEW_NTDOMAIN/ { + printf "#endif\n" +} + +# we handle the loadparm.c fns separately + +/^FN_LOCAL_BOOL/ { + split($0,a,"[,()]") + printf "BOOL %s(int );\n", a[2] +} + +/^FN_LOCAL_LIST/ { + split($0,a,"[,()]") + printf "char **%s(int );\n", a[2] +} + +/^FN_LOCAL_STRING/ { + split($0,a,"[,()]") + printf "char *%s(int );\n", a[2] +} + +/^FN_LOCAL_INT/ { + split($0,a,"[,()]") + printf "int %s(int );\n", a[2] +} + +/^FN_LOCAL_CHAR/ { + split($0,a,"[,()]") + printf "char %s(int );\n", a[2] +} + +/^FN_GLOBAL_BOOL/ { + split($0,a,"[,()]") + printf "BOOL %s(void);\n", a[2] +} + +/^FN_GLOBAL_LIST/ { + split($0,a,"[,()]") + printf "char **%s(void);\n", a[2] +} + +/^FN_GLOBAL_STRING/ { + split($0,a,"[,()]") + printf "char *%s(void);\n", a[2] +} + +/^FN_GLOBAL_INT/ { + split($0,a,"[,()]") + printf "int %s(void);\n", a[2] +} + +/^static|^extern/ || !/^[a-zA-Z]/ || /[;]/ { + next; +} + +# +# We have to split up the start +# matching as we now have so many start +# types that it can cause some versions +# of nawk/awk to choke and fail on +# the full match. JRA. +# + +{ + gotstart = 0; + if( $0 ~ /^const|^connection_struct|^pipes_struct|^smb_np_struct|^file_fd_struct|^files_struct|^connection_struct|^uid_t|^gid_t|^unsigned|^mode_t|^DIR|^user|^int|^pid_t|^ino_t|^off_t|^double/ ) { + gotstart = 1; + } + + if( $0 ~ /^vuser_key|^UNISTR2|^LOCAL_GRP|^DOMAIN_GRP|^SMB_STRUCT_DIRENT|^SEC_ACL|^SEC_DESC|^SEC_DESC_BUF|^DOM_SID|^RPC_HND_NODE|^BYTE/ ) { + gotstart = 1; + } + + if( $0 ~ /^ADS_STRUCT|^ADS_STATUS|^DATA_BLOB|^ASN1_DATA|^TDB_CONTEXT|^TDB_DATA|^smb_ucs2_t|^TALLOC_CTX|^hash_element|^NT_DEVICEMODE|^enum.*\(|^NT_USER_TOKEN|^SAM_ACCOUNT/ ) { + gotstart = 1; + } + + if( $0 ~ /^smb_iconv_t|^long|^char|^uint|^NTSTATUS|^WERROR|^CLI_POLICY_HND|^struct|^BOOL|^void|^time|^smb_shm_offset_t|^shm_offset_t|^FILE|^XFILE|^SMB_OFF_T|^size_t|^ssize_t|^SMB_BIG_UINT/ ) { + gotstart = 1; + } + + if( $0 ~ /^SAM_ACCT_INFO_NODE|^SMB_ACL_T|^ADS_MODLIST|^PyObject/ ) { + gotstart = 1; + } + + if(!gotstart) { + next; + } +} + + +/[(].*[)][ \t]*$/ { + printf "%s;\n",$0; + next; +} + +/[(]/ { + inheader=1; + printf "%s\n",$0; + next; +} + diff --git a/source3/script/mkproto.sh b/source3/script/mkproto.sh new file mode 100755 index 0000000000..4dbe4c204e --- /dev/null +++ b/source3/script/mkproto.sh @@ -0,0 +1,41 @@ +#! /bin/sh + +LANG=C; export LANG +LC_ALL=C; export LC_ALL +LC_COLLATE=C; export LC_COLLATE + +if [ $# -lt 3 ] +then + echo "Usage: $0 awk [-h headerdefine] outputheader proto_obj" + exit 1 +fi + +awk="$1" +shift + +if [ x"$1" = x-h ] +then + headeropt="-v headername=$2" + shift; shift; +else + headeropt="" +fi + +header="$1" +shift +headertmp="$header.$$.tmp~" + +proto_src="`echo $@ | tr ' ' '\n' | sed -e 's/\.o/\.c/g' | sort | uniq | egrep -v 'ubiqx/|wrapped'`" + +echo creating $header + +${awk} $headeropt \ + -f script/mkproto.awk $proto_src > $headertmp + +if cmp -s $header $headertmp 2>/dev/null +then + echo "$header unchanged" + rm $headertmp +else + mv $headertmp $header +fi diff --git a/source3/script/mksmbpasswd.sh b/source3/script/mksmbpasswd.sh index 6e592acd65..854e1bd1b5 100755 --- a/source3/script/mksmbpasswd.sh +++ b/source3/script/mksmbpasswd.sh @@ -2,5 +2,5 @@ awk 'BEGIN {FS=":" printf("#\n# SMB password file.\n#\n") } -{ printf( "%s:%s:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:%s:%s:%s\n", $1, $3, $5, $6, $7) } +{ printf( "%s:%s:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:[U ]:LCT-00000000:%s\n", $1, $3, $5) } ' diff --git a/source3/script/revert.sh b/source3/script/revert.sh index 68b47bf39d..8df5fd2fbd 100755 --- a/source3/script/revert.sh +++ b/source3/script/revert.sh @@ -3,11 +3,14 @@ BINDIR=$1 shift for p in $*; do - if [ -f $BINDIR/$p.old ]; then - echo Restoring $BINDIR/$p.old as $BINDIR/$p - mv $BINDIR/$p $BINDIR/$p.new - mv $BINDIR/$p.old $BINDIR/$p - rm -f $BINDIR/$p.new + p2=`basename $p` + if [ -f $BINDIR/$p2.old ]; then + echo Restoring $BINDIR/$p2.old + mv $BINDIR/$p2 $BINDIR/$p2.new + mv $BINDIR/$p2.old $BINDIR/$p2 + rm -f $BINDIR/$p2.new + else + echo Not restoring $p fi done diff --git a/source3/script/scancvslog.pl b/source3/script/scancvslog.pl new file mode 100755 index 0000000000..c39f9111c1 --- /dev/null +++ b/source3/script/scancvslog.pl @@ -0,0 +1,112 @@ +#!/usr/bin/perl +require"timelocal.pl"; + +# +# usage scancvslog.pl logfile starttime tag +# +# this will extract all entries from the specified cvs log file +# that have a date later than or equal to starttime and a tag +# value of tag. If starttime is not specified, all entries are +# extracted. If tag is not specified then entries for all +# branches are extracted. starttime must be specified as +# "monthname day, year" +# +# Example to extract all entries for SAMBA_2_2 branch from the +# log file named cvs.log +# +# scancvslog.pl cvs.log "" SAMBA_2_2 +# +# +# To extract all log entries after Jan 10, 1999 (Note month name +# must be spelled out completely). +# +# scancvslog.pl cvs.log "January 10, 1999" +# + +open(INFILE,@ARGV[0]) || die "Unable to open @ARGV[0]\n"; + +%Monthnum = ( + "January", 0, + "February", 1, + "March", 2, + "April", 3, + "May", 4, + "June", 5, + "July", 6, + "August", 7, + "September", 8, + "October", 9, + "November", 10, + "December", 11, + "Jan", 0, + "Feb", 1, + "Mar", 2, + "Apr", 3, + "May", 4, + "Jun", 5, + "Jul", 6, + "Aug", 7, + "Sep", 8, + "Oct", 9, + "Nov", 10, + "Dec", 11 +); + +$Starttime = (@ARGV[1]) ? &make_time(@ARGV[1]) : 0; +$Tagvalue = @ARGV[2]; + +while (&get_entry) { + $_=$Entry[0]; +# get rid of extra white space + s/\s+/ /g; +# get rid of any time string in date + s/ \d\d:\d\d:\d\d/,/; + s/^Date:\s*\w*\s*(\w*)\s*(\w*),\s*(\w*).*/$1 $2 $3/; + $Testtime = &make_time($_); + $Testtag = &get_tag; + if (($Testtime >= $Starttime) && ($Tagvalue eq $Testtag)) { + print join("\n",@Entry),"\n"; + } +} +close(INFILE); + +sub make_time { + $_ = @_[0]; + s/,//; + ($month, $day, $year) = split(" ",$_); + if (($year < 1900)||($day < 1)||($day > 31)||not length($Monthnum{$month})) { + print "Bad date format @_[0]\n"; + print "Date needs to be specified as \"Monthname day, year\"\n"; + print "eg: \"January 10, 1999\"\n"; + exit 1; + } + $year = ($year == 19100) ? 2000 : $year; + $month = $Monthnum{$month}; + $Mytime=&timelocal((0,0,0,$day,$month,$year)); +} + +sub get_tag { + @Mytag = grep (/Tag:/,@Entry); + $_ = @Mytag[0]; + s/^.*Tag:\s*(\w*).*/$1/; + return $_; +} + +sub get_entry { + @Entry=(); + if (not eof(INFILE)) { + while (not eof(INFILE)) { + $_ = <INFILE>; + chomp $_; + next if (not ($_)); + if (/^\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/) { + next if ($#Entry == -1); + push(Entry,$_); + return @Entry; + } else { + push(Entry,$_); + } + } + } + return @Entry; +} diff --git a/source3/script/smbtar b/source3/script/smbtar index fc032ed41c..cf3ff0ebe6 100644 --- a/source3/script/smbtar +++ b/source3/script/smbtar @@ -6,13 +6,19 @@ # and Ricky Poulten (ricky@logcam.co.uk) # # (May need to change shell to ksh for HPUX or OSF for better getopts) +# +# sandy nov 3 '98 added -a flag +# +# Richard Sharpe, added -c 'tarmode full' so that we back up all files to +# fix a bug in clitar when a patch was added to stop system and hidden files +# being backed up. case $0 in # when called by absolute path, assume smbclient is in the same directory /*) SMBCLIENT="`dirname $0`/smbclient";; - *) # edit this to show where your smbclient is - SMBCLIENT="./smbclient";; + *) # you may need to edit this to show where your smbclient is + SMBCLIENT="smbclient";; esac # These are the default values. You could fill them in if you know what @@ -24,7 +30,10 @@ username=$LOGNAME # Default: same user name as in *nix verbose="2>/dev/null" # Default: no echo to stdout log="-d 2" newer="" +newerarg="" blocksize="" +blocksizearg="" +clientargs="-c 'tarmode full'" tarcmd="c" tarargs="" cdcmd="\\" @@ -38,6 +47,7 @@ Function: backup/restore a Windows PC directories to a local tape file Options: (Description) (Default) -r Restore from tape file to PC Save from PC to tapefile -i Incremental mode Full backup mode + -a Reset archive bit mode Don't reset archive bit -v Verbose mode: echo command Don't echo anything -s <server> Specify PC Server $server -p <password> Specify PC Password $password @@ -54,7 +64,17 @@ Options: (Description) (Default) exit $ex } -while getopts rivl:b:d:N:s:p:x:u:Xt: c; do +# echo Params count: $# + +# DEC OSF AKA Digital UNIX does not seem to return a value in OPTIND if +# there are no command line params, so protect us against that ... +if [ $# = 0 ]; then + + Usage 2 "Please enter a command line parameter!" + +fi + +while getopts riavl:b:d:N:s:p:x:u:Xt: c; do case $c in r) # [r]estore to Windows (instead of the default "Save from Windows") tarcmd="x" @@ -62,6 +82,9 @@ while getopts rivl:b:d:N:s:p:x:u:Xt: c; do i) # [i]ncremental tarargs=${tarargs}g ;; + a) # [a]rchive + tarargs=${tarargs}a + ;; l) # specify [l]og file log="-d $OPTARG" case "$OPTARG" in @@ -76,7 +99,7 @@ while getopts rivl:b:d:N:s:p:x:u:Xt: c; do N) # compare with a file, test if [n]ewer if [ -f $OPTARG ]; then newer=$OPTARG - tarargs=${tarargs}N + newerarg="N" else echo >&2 $0: Warning, $OPTARG not found fi @@ -88,13 +111,13 @@ while getopts rivl:b:d:N:s:p:x:u:Xt: c; do server="$OPTARG" ;; b) # specify [b]locksize - blocksize="blocksize $OPTARG" + blocksize="$OPTARG" case "$OPTARG" in [0-9]*) ;; *) echo >&2 "$0: Error, block size not numeric: -b $OPTARG" exit 1 esac - tarargs=${tarargs}b + blocksizearg="b" ;; p) # specify [p]assword to use password="$OPTARG" @@ -134,8 +157,8 @@ if [ -z "$verbose" ]; then echo "blocksize is $blocksize" fi -eval $SMBCLIENT "'\\\\$server\\$service'" "'$password'" -U "'$username'" \ --E -N $log -D "'$cdcmd'" \ --T${tarcmd}${tarargs} $blocksize $newer $tapefile $* $verbose - +tarargs=${tarargs}${blocksizearg}${newerarg} +eval $SMBCLIENT "'\\\\$server\\$service'" "'$password'" -U "'$username'" \ +-E -N $log -D "'$cdcmd'" ${clientargs} \ +-T${tarcmd}${tarargs} $blocksize $newer $tapefile '${1+"$@"}' $verbose diff --git a/source3/script/uninstallbin.sh b/source3/script/uninstallbin.sh new file mode 100755 index 0000000000..53775f8946 --- /dev/null +++ b/source3/script/uninstallbin.sh @@ -0,0 +1,42 @@ +#!/bin/sh +#4 July 96 Dan.Shearer@UniSA.edu.au + +INSTALLPERMS=$1 +BASEDIR=$2 +BINDIR=$3 +LIBDIR=$4 +VARDIR=$5 +shift +shift +shift +shift +shift + +if [ ! -d $BINDIR ]; then + echo Directory $BINDIR does not exist! + echo Do a "make installbin" or "make install" first. + exit 1 +fi + +for p in $*; do + p2=`basename $p` + if [ -f $BINDIR/$p2 ]; then + echo Removing $BINDIR/$p2 + rm -f $BINDIR/$p2 + if [ -f $BINDIR/$p2 ]; then + echo Cannot remove $BINDIR/$p2 ... does $USER have privileges? + fi + fi +done + + +cat << EOF +====================================================================== +The binaries have been uninstalled. You may restore the binaries using +the command "make installbin" or "make install" to install binaries, +man pages and shell scripts. You can restore a previous version of the +binaries (if there were any) using "make revert". +====================================================================== +EOF + +exit 0 diff --git a/source3/script/uninstallcp.sh b/source3/script/uninstallcp.sh new file mode 100755 index 0000000000..2a9e9d509a --- /dev/null +++ b/source3/script/uninstallcp.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +CPDIR=$1 +shift + +if [ ! -d $CPDIR ]; then + echo Directory $CPDIR does not exist! + echo Do a "make installcp" or "make install" first. + exit 1 +fi + +for p in $*; do + if [ ! -f $CPDIR/unicode_map.$p ]; then + echo $CPDIR/unicode_map.$p does not exist! + else + echo Removing $CPDIR/unicode_map.$p + rm -f $CPDIR/unicode_map.$p + if [ -f $CPDIR/unicode_map.$p ]; then + echo Cannot remove $CPDIR/unicode_map.$p... does $USER have privileges? + fi + fi +done + +cat << EOF +====================================================================== +The code pages have been uninstalled. You may reinstall them using +the command "make installcp" or "make install" to install binaries, +man pages, shell scripts and code pages. You may recover a previous version +(if any with "make revert"). +====================================================================== +EOF + +exit 0 diff --git a/source3/script/uninstallman.sh b/source3/script/uninstallman.sh new file mode 100755 index 0000000000..3126709831 --- /dev/null +++ b/source3/script/uninstallman.sh @@ -0,0 +1,37 @@ +#!/bin/sh +#4 July 96 Dan.Shearer@UniSA.edu.au +# +# 13 Aug 2001 Rafal Szczesniak <mimir@spin.ict.pwr.wroc.pl> +# modified to accomodate international man pages (inspired +# by Japanese edition's approach) + + +MANDIR=$1 +SRCDIR=$2 +langs=$3 + +for lang in $langs; do + echo Uninstalling \"$lang\" man pages from $MANDIR/$lang + + for sect in 1 5 7 8 ; do + for m in $MANDIR/$lang/man$sect ; do + for s in $SRCDIR/../docs/manpages/$lang/*$sect; do + FNAME=$m/`basename $s` + if test -f $FNAME; then + echo Deleting $FNAME + rm -f $FNAME + test -f $FNAME && echo Cannot remove $FNAME... does $USER have privileges? + fi + done + done + done +done + +cat << EOF +====================================================================== +The man pages have been uninstalled. You may install them again using +the command "make installman" or make "install" to install binaries, +man pages and shell scripts. +====================================================================== +EOF +exit 0 diff --git a/source3/script/uninstallscripts.sh b/source3/script/uninstallscripts.sh new file mode 100755 index 0000000000..13104acedd --- /dev/null +++ b/source3/script/uninstallscripts.sh @@ -0,0 +1,36 @@ +#!/bin/sh +# 5 July 96 Dan.Shearer@UniSA.Edu.Au - almost identical to uninstallbin.sh + +INSTALLPERMS=$1 +BINDIR=$2 + +shift +shift + +if [ ! -d $BINDIR ]; then + echo Directory $BINDIR does not exist! + echo Do a "make installscripts" or "make install" first. + exit 1 +fi + +for p in $*; do + p2=`basename $p` + if [ -f $BINDIR/$p2 ]; then + echo Removing $BINDIR/$p2 + rm -f $BINDIR/$p2 + if [ -f $BINDIR/$p2 ]; then + echo Cannot remove $BINDIR/$p2 ... does $USER have privileges? + fi + fi +done + +cat << EOF +====================================================================== +The scripts have been uninstalled. You may reinstall them using +the command "make installscripts" or "make install" to install binaries, +man pages and shell scripts. You may recover a previous version (if any +with "make revert". +====================================================================== +EOF + +exit 0 |