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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
|
from gtk import *
from iw_gui import *
from translate import _
class AuthWindow (InstallWindow):
def __init__ (self, ics):
InstallWindow.__init__ (self, ics)
self.todo = ics.getToDo ()
ics.setTitle (_("Authentication Configuration"))
## ics.setHTML ("<HTML><BODY>Select authentication methods"
## "</BODY></HTML>")
ics.readHTML ("authconf")
ics.setNextEnabled (TRUE)
def setSensitivities (self, *args):
if (not self.nis.get_active()):
self.nisDomain.set_sensitive (FALSE)
self.nisBroadcast.set_sensitive (FALSE)
self.nisServer.set_sensitive (FALSE)
self.nisDomainLabel.set_sensitive (FALSE)
self.nisServerLabel.set_sensitive (FALSE)
else:
self.nisDomain.set_sensitive (TRUE)
self.nisDomainLabel.set_sensitive (TRUE)
self.nisBroadcast.set_sensitive (TRUE)
if (self.nisBroadcast.get_active()):
self.nisServerLabel.set_sensitive (FALSE)
self.nisServer.set_sensitive (FALSE)
else:
self.nisServerLabel.set_sensitive (TRUE)
self.nisServer.set_sensitive (TRUE)
ldapactive = self.ldap.get_active()
self.ldapServerLabel.set_sensitive (ldapactive)
self.ldapServer.set_sensitive (ldapactive)
self.ldapBasednLabel.set_sensitive (ldapactive)
self.ldapBasedn.set_sensitive (ldapactive)
krb5active = self.krb5.get_active()
self.krb5RealmLabel.set_sensitive (krb5active)
self.krb5Realm.set_sensitive (krb5active)
self.krb5KdcLabel.set_sensitive (krb5active)
self.krb5Kdc.set_sensitive (krb5active)
self.krb5AdminLabel.set_sensitive (krb5active)
self.krb5Admin.set_sensitive (krb5active)
def getNext(self):
if not self.__dict__.has_key("md5"):
return None
self.todo.auth.useMD5 = self.md5.get_active ()
self.todo.auth.useShadow = self.shadow.get_active ()
self.todo.auth.useNIS = self.nis.get_active ()
self.todo.auth.nisuseBroadcast = self.nisBroadcast.get_active ()
self.todo.auth.nisDomain = self.nisDomain.get_text ()
self.todo.auth.nisServer = self.nisServer.get_text ()
self.todo.auth.useLdap = self.ldap.get_active ()
self.todo.auth.useLdapauth = self.ldap.get_active ()
self.todo.auth.ldapServer = self.ldapServer.get_text ()
self.todo.auth.ldapBasedn = self.ldapBasedn.get_text ()
self.todo.auth.useKrb5 = self.krb5.get_active ()
self.todo.auth.krb5Realm = self.krb5Realm.get_text ()
self.todo.auth.krb5Kdc = self.krb5Kdc.get_text ()
self.todo.auth.krb5Admin = self.krb5Admin.get_text ()
def getScreen (self):
box = GtkVBox (FALSE, 10)
self.md5 = GtkCheckButton (_("Enable MD5 passwords"))
self.shadow = GtkCheckButton (_("Enable shadow passwords"))
# nis
self.nis = GtkCheckButton (_("Enable NIS"))
self.nisBroadcast = GtkCheckButton (_("Use broadcast to find NIS server"))
self.nisDomain = GtkEntry ()
self.nisServer = GtkEntry ()
self.md5.set_active (self.todo.auth.useMD5)
self.shadow.set_active (self.todo.auth.useShadow)
self.nis.set_active (self.todo.auth.useNIS)
self.nisDomain.set_text (self.todo.auth.nisDomain)
self.nisBroadcast.set_active (self.todo.auth.nisuseBroadcast)
self.nisServer.set_text (self.todo.auth.nisServer )
self.nisDomainLabel = GtkLabel (_("NIS Domain: "))
self.nisDomainLabel.set_alignment (0, 0)
self.nisServerLabel = GtkLabel (_("NIS Server: "))
self.nisServerLabel.set_alignment (0, 0)
self.nis.connect ("toggled", self.setSensitivities)
self.nisBroadcast.connect ("toggled", self.setSensitivities)
hbox1 = GtkHBox ()
hbox1.pack_start (self.nisDomainLabel, FALSE)
hbox1.pack_start (self.nisDomain)
hbox2 = GtkHBox ()
hbox2.pack_start (self.nisServerLabel, FALSE)
hbox2.pack_start (self.nisServer)
a = GtkAlignment (0, 0)
a.add (self.nisBroadcast)
nistable = GtkTable (10, 4)
nistable.attach (self.nis, 0, 10, 0, 1)
nistable.attach (hbox1, 2, 10, 1, 2)
nistable.attach (a, 2, 10, 2, 3, xoptions = EXPAND|FILL)
nistable.attach (hbox2, 4, 10, 3, 4)
# ldap
self.ldap = GtkCheckButton (_("Enable LDAP"))
self.ldapServer = GtkEntry ()
self.ldapBasedn = GtkEntry ()
self.ldapServerLabel = GtkLabel (_("LDAP Server:"))
self.ldapServerLabel.set_alignment (0, 0)
self.ldapBasednLabel = GtkLabel (_("LDAP Base DN:"))
self.ldapBasednLabel.set_alignment (0, 0)
# restore ldap settings
self.ldap.set_active (self.todo.auth.useLdap)
self.ldapServer.set_text (self.todo.auth.ldapServer)
self.ldapBasedn.set_text (self.todo.auth.ldapBasedn)
ldaptable = GtkTable (10, 4)
ldaptable.attach (self.ldap, 0, 10, 0, 1)
spacer = GtkLabel("")
spacer.set_usize(10, 1)
ldaptable.attach (spacer, 0, 1, 1, 2)
ldaptable.attach (self.ldapServerLabel, 2, 3, 1, 2)
ldaptable.attach (self.ldapServer, 3, 10, 1, 2)
spacer = GtkLabel("")
spacer.set_usize(10, 1)
ldaptable.attach (spacer, 0, 1, 2, 3)
ldaptable.attach (self.ldapBasednLabel, 2, 3, 2, 3)
ldaptable.attach (self.ldapBasedn, 3, 10, 2, 3)
self.ldap.connect ("toggled", self.setSensitivities)
# krb5
self.krb5 = GtkCheckButton (_("Enable Kerberos"))
self.krb5Realm = GtkEntry ()
self.krb5Kdc = GtkEntry ()
self.krb5Admin = GtkEntry ()
self.krb5RealmLabel = GtkLabel (_("Realm:"))
self.krb5RealmLabel.set_alignment (0, 0)
self.krb5KdcLabel = GtkLabel (_("KDC:"))
self.krb5KdcLabel.set_alignment (0, 0)
self.krb5AdminLabel = GtkLabel (_("Admin Server:"))
self.krb5AdminLabel.set_alignment (0, 0)
# restore krb5 settings
self.krb5.set_active (self.todo.auth.useKrb5)
self.krb5Realm.set_text (self.todo.auth.krb5Realm)
self.krb5Kdc.set_text (self.todo.auth.krb5Kdc)
self.krb5Admin.set_text (self.todo.auth.krb5Admin)
krb5table = GtkTable (10, 4)
krb5table.attach (self.krb5, 0, 10, 0, 1)
spacer = GtkLabel("")
spacer.set_usize(10, 1)
krb5table.attach (spacer, 0, 1, 1, 2)
krb5table.attach (self.krb5RealmLabel, 2, 3, 1, 2)
krb5table.attach (self.krb5Realm, 3, 10, 1, 2)
spacer = GtkLabel("")
spacer.set_usize(10, 1)
krb5table.attach (spacer, 0, 1, 2, 3)
krb5table.attach (self.krb5KdcLabel, 2, 3, 2, 3)
krb5table.attach (self.krb5Kdc, 3, 10, 2, 3)
spacer = GtkLabel("")
spacer.set_usize(10, 1)
krb5table.attach (spacer, 0, 1, 3, 4)
krb5table.attach (self.krb5AdminLabel, 2, 3, 3, 4)
krb5table.attach (self.krb5Admin, 3, 10, 3, 4)
self.krb5.connect ("toggled", self.setSensitivities)
# pack everything
self.setSensitivities()
box.pack_start (self.md5, FALSE)
box.pack_start (self.shadow, FALSE)
box.pack_start (nistable, FALSE)
box.pack_start (ldaptable, FALSE)
box.pack_start (krb5table, FALSE)
box.set_border_width (5)
return box
|