1 $mechanism = @("anonymous", "crammd5", "digestmd5", "scram", "gssapiv2", "kerberos4", "login", "ntlm", "otp", "passdss", "plain", "srp", "gs2")
2 $pluginsDir = "..\plugins\"
3 
4 for ($i = 0; $i -le $mechanism.Count - 1; $i++)
5 {
6 	$targetFilename = "$pluginsDir$($mechanism[$i])_init.c"
7 	if (-Not (Test-Path -Path $targetFilename) -Or (Get-ChildItem $targetFilename).CreationTime -lt (Get-ChildItem "init_mechanism.c").CreationTime) {
8 		(gc init_mechanism.c) -replace 'MECHANISM', $mechanism[$i] | Set-Content $targetFilename
9 		Write-Host " * Make init for  '" $mechanism[$i] "'"
10 	}
11 }
12 
13 $auxprop = @("sasldb", "sql", "ldapdb")
14 for ($i = 0; $i -le $auxprop.Count - 1; $i++)
15 {
16 	$targetFilename = "$pluginsDir$($auxprop[$i])_init.c"
17 	if (-Not (Test-Path -Path $targetFilename) -Or (Get-ChildItem $targetFilename).CreationTime -lt (Get-ChildItem "init_auxprop.c").CreationTime) {
18 		(gc init_auxprop.c) -replace 'AUXPROP_REPLACE', $auxprop[$i] | Set-Content $targetFilename
19 		Write-Host " * Make init for  '" $auxprop[$i] "'"
20 	}
21 }
22 
23 "SASL_CANONUSER_PLUG_INIT( ldapdb )" | Add-Content "$($pluginsDir)ldapdb_init.c"