summaryrefslogtreecommitdiffstats
path: root/source3/script/updatesmbpasswd.sh
blob: 1d7e0d7332f3f72b098ab9e65f72b66650cb9072 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh
nawk 'BEGIN {FS=":"} 
{
	if( $0 ~ "^#" ) {
		print $0
	} else if( (length($4) == 32) && (($4 ~ "^[0-9A-F]*$") || ($4 ~ "^[X]*$") || ( $4 ~ "^[*]*$"))) {
		print $0
	} else {
		printf( "%s:%s:%s:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:", $1, $2, $3);
		for(i = 4; i <= NF; i++)
			printf("%s:", $i)
		printf("\n")
	}
}'