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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
|
package nslcd_proto
import (
"io"
"fmt"
"net"
)
//#include "nslcd.h"
import "C"
type Config struct {
Value string
}
type Request_Config struct { Key int32 }
type Alias struct {
Name string
Recipients []string
}
type Request_Alias_ByName struct { Name string }
type Request_Alias_All struct {}
type Ether struct {
Name string
Address [6]byte
}
type Request_Ether_ByName struct { Name string }
type Request_Ether_ByEther struct { Address [6]byte }
type Request_Ether_All struct {}
type Group struct {
Name string
Password string
ID int32
Members []string
}
type Request_Group_ByName struct { Name string }
type Request_Group_ByGid struct { GID int32 }
type Request_Group_ByMember struct { Member string }
type Request_Group_All struct {}
type Host struct {
Name string
Aliases []string
Addresses []net.IP
}
type Request_Host_ByName struct { Name string }
type Request_Host_ByAddr struct { Address net.IP }
type Request_Host_All struct {}
type Netgroup_Netgroup struct {
Name string
}
type Netgroup_Triple struct {
Host string
User string
Domain string
}
type Netgroup_PartList []interface{}
func (data Netgroup_PartList) NslcdWrite(fd io.Writer) {
for _, part := range data {
var t int32 = -1
switch part.(type) {
case Netgroup_Netgroup: t = C.NSLCD_NETGROUP_TYPE_NETGROUP
case Netgroup_Triple: t = C.NSLCD_NETGROUP_TYPE_TRIPLE
}
if t < 0 {
panic("invalid netgroup type")
}
write(fd, t)
write(fd, part)
}
write(fd, int32(C.NSLCD_NETGROUP_TYPE_END))
}
func (data *Netgroup_PartList) NslcdRead(fd io.Reader) {
*data = make([]interface{}, 0)
for {
var t int32
var v interface{}
read(fd, &t)
switch t {
case C.NSLCD_NETGROUP_TYPE_NETGROUP:
v = Netgroup_Netgroup{}
case C.NSLCD_NETGROUP_TYPE_TRIPLE:
v = Netgroup_Triple{}
case C.NSLCD_NETGROUP_TYPE_END:
return
default:
panic(NslcdError(fmt.Sprintf("unrecognized netgroup type: %d", t)))
}
read(fd, &v)
*data = append(*data, v)
}
}
var _ NslcdObject = Netgroup_PartList{}
var _ NslcdObjectPtr = &Netgroup_PartList{}
type Netgroup struct {
Name string
Parts Netgroup_PartList
}
type Request_Netgroup_ByName struct { Name string }
type Request_Netgroup_All struct {}
type Network struct {
Name string
Aliases []string
Addresses []net.IP
}
type Request_Network_ByName struct { Name string }
type Request_Network_ByAddr struct { Address net.IP }
type Request_Network_All struct {}
type Passwd struct {
Name string
Password string
UID int32
GID int32
GECOS string
HomeDir string
Shell string
}
type Request_Passwd_ByName struct { Name string }
type Request_Passwd_ByUID struct { UID int32 }
type Request_Passwd_All struct {}
type Protocol struct {
Name string
Aliases []string
Number int32
}
type Request_Protocol_ByName struct { Name string }
type Request_Protocol_ByNumber struct { Number int32 }
type Request_Protocol_All struct {}
type RPC struct {
Name string
Aliases []string
Number int32
}
type Request_RPC_ByName struct { Name string }
type Request_RPC_ByNumber struct { Number int32 }
type Request_RPC_All struct {}
type Service struct {
Name string
Aliases []string
PortNumber int32
Protocol string
}
type Request_Service_ByName struct { Name string }
type Request_Service_ByNumber struct { Number int32 }
type Request_Service_All struct {}
type Shadow struct {
Name string
Password string
LastChangeDate int32
MinDays int32
MaxDays int32
WarnDays int32
InactDays int32
ExpireDate int32
Flag int32
}
type Request_Shadow_ByName struct { Name string }
type Request_Shadow_All struct {}
type PAM_Base struct {
UserName string
ServiceName string
RUser string
RHost string
TTY string
}
type Request_PAM_Authentication struct {
Base PAM_Base
Password string
}
type PAM_Authentication struct {
AuthenticationResult int32
UserName string
AuthorizationResult int32
AuthorizationError string
}
type PAM_Authorization struct {
Result int32
Error string
}
type Request_PAM_Authorization struct {}
type PAM_SessionOpen struct {
SessionID string
}
type Request_PAM_SessionOpen struct {}
type PAM_SessionClose struct {}
type Request_PAM_SessionClose struct {
SessionID string
}
type Request_PAM_PwMod struct {
AsRoot int32
OldPassword string
NewPassword string
}
type PAM_PwMod struct {
Result int32
Error string
}
type UserMod_Item struct {
Key int32
Value string
}
type UserMod_ItemList []UserMod_Item
func (data UserMod_ItemList) NslcdWrite(fd io.Writer) {
for _, item := range data {
write(fd, item)
}
write(fd, int32(C.NSLCD_USERMOD_END))
}
func (data *UserMod_ItemList) NslcdRead(fd io.Reader) {
*data = make([]UserMod_Item, 0)
for {
var t int32
read(fd, &t)
if t == C.NSLCD_USERMOD_END {
return
}
var v UserMod_Item
read(fd, &v)
*data = append(*data, v)
}
}
var _ NslcdObject = UserMod_ItemList{}
var _ NslcdObjectPtr = &UserMod_ItemList{}
type Request_UserMod struct {
UserName string
AsRoot int32
Password string
Items UserMod_ItemList
}
type UserMod struct {
Items []UserMod_Item
}
|