2 # edit the line above to point to your real location of awk interpreter
4 # awk program for adding new entries in smbpasswd files
5 # arguments are account names to add; feed it an existent Samba password
6 # file on stdin, results will be written on stdout
8 # Michal Jaegermann, michal@ellpspace.math.ualberta.ca, 1995-11-09
17 "name1 [name2 ....] < smbpasswd.in > smbpasswd.out";
18 ARGV[1] =
"/dev/null";
23 for(i =
1; i
< count
; i
++) {
27 # sane awk should work simply with 'ARGC = 1', but not every awk
28 # implementation is sane - big sigh!!
32 # If you have ypmatch but is not RPC registered (some Linux systems
33 # for example) comment out the next line.
34 # "which ypmatch" | getline ypmatch;
35 if (1 != match(ypmatch
, /^\
//)) {
40 #check for names already present in input
50 fmt =
"%s:%s:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:";
51 fmt = fmt
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:[U ]:LCT-00000000:%s:\n";
53 while ((getline < pwdf
) > 0) {
55 printf(fmt
, $
1, $
3, $
5);
63 if (notfound
&& ypmatch
) {
64 # try to find in NIS databases
65 command = ypmatch
" " name
" passwd";
68 printf(fmt
, $
1, $
3, $
5);