-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConfigure.jsp
158 lines (104 loc) · 2.92 KB
/
Configure.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<%@page import="java.io.*, java.util.StringTokenizer"%>
<html>
<head>
<title> .: LDAP GUI for Academic Institutes :. Configuring the Server</title>
</head>
<body>
<%!
String CollegeName;
String Domain;
int deptno;
String dn;
String deptname[]=new String[20];
String file[]=new String[20];
String dep="";
%>
<%
int j=5;
dep="";
// Get Values from the previous form
CollegeName=request.getParameter("Clgname");
Domain=request.getParameter("domain");
deptno=Integer.parseInt(request.getParameter("DeptNo"));
dn=request.getParameter("dn");
for(int i=1;i<=deptno;i++)
{
String whichDept=Integer.toString(i);
//out.println(whichDept);
deptname[i]=request.getParameter(whichDept);
//out.println(deptname[i]);
if(!deptname[i].equalsIgnoreCase(null))
{
dep+=deptname[i]+" ";
file[j]=deptname[i]+".ldif";
j++;
}
}
//out.println("DEPT IS : "+dep);
%>
<font color="darkblue">
<h1 align=center>LDAP GUI for Academic Institutes</h1>
</font>
<center>
<!--
Run the Make_slapd_conf.sh file here
-->
<h4 align="center">
.: Hierarchy and Group file creation Status:.
</h4>
<%
Runtime r=Runtime.getRuntime();
Process p=null;
String cmd="";
cmd="sudo /usr/local/apache-tomcat-6.0.29/webapps/ROOT/LDAP/Scripts/CreateLDIF.sh "+Domain+" "+dn+" "+deptno+" "+dep+" students staff ntstaff";
//out.println("THE COOMMOND EXECUTED IS : "+cmd);
try{
p=r.exec(cmd);
InputStreamReader isr=new InputStreamReader(p.getInputStream());
BufferedReader br=new BufferedReader(isr);
String line=null;
while((line = br.readLine()) != null){
out.write(line);
}
p.waitFor();
out.println("<font color=green>");
out.println("Hierarchy and group files are created successfully with domain name: </font><font color=darkblue>"+Domain+"</font>");
out.println("<br><br>");
out.println("<b>.: Files created are :. </b><br>");
file[1]="hierarchy.ldif";
file[2]="students.ldif";
file[3]="staff.ldif";
file[4]="ntstaff.ldif";
for(int k=1;k<=deptno+4;k++)
{
out.println(file[k]+"<br>");
}
// out.println("<br>hierarchy.ldif<br>students.ldif<br>staff.ldif<br>ntstaff.ldif<br>");
}
catch(Exception e){
out.println("<font color=red>");
out.println("Error in creating hierarchy and group files with domain name: </font><font color=darkblue>"+Domain+"</font>");
out.println("Error Message End");
}
%>
<form action="ServerStartAdding.jsp">
<br>
<br>
<!--
Simply carry these values forward to the next page
-->
<input type="hidden" name="Clgname" value="<%=CollegeName%>">
<input type="hidden" name="domain" value="<%=Domain%>">
<input type="hidden" name="DeptNo" value="<%=deptno%>">
<input type="hidden" name="dn" value="<%=dn%>">
<%
for(int k=1;k<=deptno+4;k++)
{
out.println("<input type=hidden name="+k+" value="+file[k]+">");
}
%>
<input type="Submit" value="Start Server and Add Files"></td>
</form>
</center>
</body>
</html>