1 |
|
---|
2 |
|
---|
3 |
|
---|
4 |
|
---|
5 |
|
---|
6 |
|
---|
7 |
|
---|
8 |
|
---|
9 |
|
---|
10 |
|
---|
11 |
|
---|
12 |
|
---|
13 |
|
---|
14 |
|
---|
15 |
|
---|
16 |
use DBI; |
---|
17 |
use DBD::Pg; |
---|
18 |
use DBD::SQLite; |
---|
19 |
|
---|
20 |
$path = $0; |
---|
21 |
$path =~ s/envpolicyupdate.pl$//i; |
---|
22 |
if ($path ne "./"){ |
---|
23 |
push( @INC, "$path"); |
---|
24 |
} |
---|
25 |
|
---|
26 |
require "foltialib.pl"; |
---|
27 |
|
---|
28 |
|
---|
29 |
$returnparam = getphpstyleconfig("useenvironmentpolicy"); |
---|
30 |
eval "$returnparam\n"; |
---|
31 |
|
---|
32 |
if ($useenvironmentpolicy == 1){ |
---|
33 |
$returnparam = getphpstyleconfig("environmentpolicytoken"); |
---|
34 |
eval "$returnparam\n"; |
---|
35 |
|
---|
36 |
$dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; |
---|
37 |
|
---|
38 |
$envph = $dbh->prepare($stmt{'envpolicyupdate.1'}); |
---|
39 |
$envph->execute(); |
---|
40 |
|
---|
41 |
|
---|
42 |
unless (-e "$toolpath/.htpasswd"){ |
---|
43 |
$oserr = `touch $toolpath/.htpasswd`; |
---|
44 |
}else{ |
---|
45 |
$oserr = `mv $toolpath/.htpasswd $toolpath/htpasswd_foltia_old`; |
---|
46 |
$oserr = `touch $toolpath/.htpasswd`; |
---|
47 |
} |
---|
48 |
|
---|
49 |
while (@ref = $envph->fetchrow_array ){ |
---|
50 |
|
---|
51 |
if ($ref[0] == 0){ |
---|
52 |
|
---|
53 |
|
---|
54 |
|
---|
55 |
|
---|
56 |
|
---|
57 |
|
---|
58 |
|
---|
59 |
$htpasswd = "$ref[2]"; |
---|
60 |
}else{ |
---|
61 |
$htpasswd = "$ref[2]"."$environmentpolicytoken"; |
---|
62 |
} |
---|
63 |
|
---|
64 |
$oserr = `htpasswd -b $toolpath/.htpasswd $ref[1] $htpasswd`; |
---|
65 |
|
---|
66 |
|
---|
67 |
} |
---|
68 |
&writelog("envpolicyupdate htpasswd updated."); |
---|
69 |
|
---|
70 |
} |
---|