-
Notifications
You must be signed in to change notification settings - Fork 2
/
server.go
345 lines (325 loc) · 21.2 KB
/
server.go
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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
package ifsrmquotamanager
import (
"context"
"fmt"
"strings"
"unicode/utf16"
dcerpc "github.com/oiweiwei/go-msrpc/dcerpc"
errors "github.com/oiweiwei/go-msrpc/dcerpc/errors"
uuid "github.com/oiweiwei/go-msrpc/midl/uuid"
idispatch "github.com/oiweiwei/go-msrpc/msrpc/dcom/oaut/idispatch/v0"
ndr "github.com/oiweiwei/go-msrpc/ndr"
)
var (
_ = context.Background
_ = fmt.Errorf
_ = utf16.Encode
_ = strings.TrimPrefix
_ = ndr.ZeroString
_ = (*uuid.UUID)(nil)
_ = (*dcerpc.SyntaxID)(nil)
_ = (*errors.Error)(nil)
_ = idispatch.GoPackage
)
// IFsrmQuotaManager server interface.
type QuotaManagerServer interface {
// IDispatch base class.
idispatch.DispatchServer
// ActionVariables operation.
GetActionVariables(context.Context, *GetActionVariablesRequest) (*GetActionVariablesResponse, error)
// ActionVariableDescriptions operation.
GetActionVariableDescriptions(context.Context, *GetActionVariableDescriptionsRequest) (*GetActionVariableDescriptionsResponse, error)
// The CreateQuota method creates a blank Non-Persisted Directory Quota Instance (section
// 3.2.1.2.1.2) for the specified path.
//
// Return Values: The method MUST return zero on success, or a nonzero error code on
// failure.
//
// +----------------------------------+--------------------------------------------------+
// | RETURN | |
// | VALUE/CODE | DESCRIPTION |
// | | |
// +----------------------------------+--------------------------------------------------+
// +----------------------------------+--------------------------------------------------+
// | 0x80045303 FSRM_E_ALREADY_EXISTS | The quota for the specified path already exists. |
// +----------------------------------+--------------------------------------------------+
// | 0x80070057 E_INVALIDARG | One of the quota parameters is NULL. |
// +----------------------------------+--------------------------------------------------+
CreateQuota(context.Context, *CreateQuotaRequest) (*CreateQuotaResponse, error)
// The CreateAutoApplyQuota method creates a Non-Persisted Auto Apply Quota Instance
// (section 3.2.1.2.2.2) for the specified path.
//
// Return Values: The method MUST return zero on success, or a nonzero error code on
// failure.
//
// +----------------------------------+-------------------------------------------------------------+
// | RETURN | |
// | VALUE/CODE | DESCRIPTION |
// | | |
// +----------------------------------+-------------------------------------------------------------+
// +----------------------------------+-------------------------------------------------------------+
// | 0x80045301 FSRM_E_NOT_FOUND | The specified auto apply quota could not be found. |
// +----------------------------------+-------------------------------------------------------------+
// | 0x80045303 FSRM_E_ALREADY_EXISTS | The auto apply quota for the specified path already exists. |
// +----------------------------------+-------------------------------------------------------------+
// | 0x80070057 E_INVALIDARG | One of the quota parameters is NULL. |
// +----------------------------------+-------------------------------------------------------------+
CreateAutoApplyQuota(context.Context, *CreateAutoApplyQuotaRequest) (*CreateAutoApplyQuotaResponse, error)
// The GetQuota method returns the directory quota from the List of Persisted Directory
// Quotas (section 3.2.1.2) for the specified path.
//
// Return Values: The method MUST return zero on success, or a nonzero error code on
// failure.
//
// +----------------------------------+----------------------------------------------------------------------------------+
// | RETURN | |
// | VALUE/CODE | DESCRIPTION |
// | | |
// +----------------------------------+----------------------------------------------------------------------------------+
// +----------------------------------+----------------------------------------------------------------------------------+
// | 0x80045301 FSRM_E_NOT_FOUND | The specified quota could not be found. |
// +----------------------------------+----------------------------------------------------------------------------------+
// | 0x80045304 FSRM_E_PATH_NOT_FOUND | The quota for the specified path could not be found. |
// +----------------------------------+----------------------------------------------------------------------------------+
// | 0x80045306 FSRM_E_INVALID_PATH | The content of the path parameter exceeds the maximum length of 4,000 |
// | | characters. |
// +----------------------------------+----------------------------------------------------------------------------------+
// | 0x80070057 E_INVALIDARG | This code is returned for the following reasons: The path parameter is NULL. The |
// | | quota parameter is NULL. |
// +----------------------------------+----------------------------------------------------------------------------------+
GetQuota(context.Context, *GetQuotaRequest) (*GetQuotaResponse, error)
// The GetAutoApplyQuota method returns the auto apply quota from the List of Persisted
// Auto Apply Quotas (section 3.2.1.2) for the specified path.
//
// Return Values: The method MUST return zero on success, or a nonzero error code on
// failure.
//
// +----------------------------------+----------------------------------------------------------------------------------+
// | RETURN | |
// | VALUE/CODE | DESCRIPTION |
// | | |
// +----------------------------------+----------------------------------------------------------------------------------+
// +----------------------------------+----------------------------------------------------------------------------------+
// | 0x80045301 FSRM_E_NOT_FOUND | The specified auto apply quota could not be found. |
// +----------------------------------+----------------------------------------------------------------------------------+
// | 0x80045304 FSRM_E_PATH_NOT_FOUND | The auto apply quota for the specified path could not be found. |
// +----------------------------------+----------------------------------------------------------------------------------+
// | 0x80045306 FSRM_E_INVALID_PATH | The content of the path parameter exceeds the maximum length of 260 characters. |
// +----------------------------------+----------------------------------------------------------------------------------+
// | 0x80070057 E_INVALIDARG | This code is returned for the following reasons: The path parameter is NULL. The |
// | | quota parameter is NULL. |
// +----------------------------------+----------------------------------------------------------------------------------+
GetAutoApplyQuota(context.Context, *GetAutoApplyQuotaRequest) (*GetAutoApplyQuotaResponse, error)
// The GetRestrictiveQuota method returns the directory quota from the List of Persisted
// Directory Quotas (section 3.2.1.2) with the lowest quota limit for the specified
// path.
//
// Return Values: The method MUST return zero on success, or a nonzero error code on
// failure.
//
// +----------------------------------+----------------------------------------------------------------------------------+
// | RETURN | |
// | VALUE/CODE | DESCRIPTION |
// | | |
// +----------------------------------+----------------------------------------------------------------------------------+
// +----------------------------------+----------------------------------------------------------------------------------+
// | 0x80045301 FSRM_E_NOT_FOUND | The specified quota could not be found. |
// +----------------------------------+----------------------------------------------------------------------------------+
// | 0x80045304 FSRM_E_PATH_NOT_FOUND | The restrictive quota for the specified path could not be found. |
// +----------------------------------+----------------------------------------------------------------------------------+
// | 0x80045306 FSRM_E_INVALID_PATH | The content of the path parameter exceeds the maximum length of 260 characters. |
// +----------------------------------+----------------------------------------------------------------------------------+
// | 0x80070057 E_INVALIDARG | This code is returned for the following reasons: The path parameter is NULL. The |
// | | quota parameter is NULL. |
// +----------------------------------+----------------------------------------------------------------------------------+
GetRestrictiveQuota(context.Context, *GetRestrictiveQuotaRequest) (*GetRestrictiveQuotaResponse, error)
// The EnumQuotas method returns all the directory quotas from the List of Persisted
// Directory Quotas (section 3.2.1.2) that fall under the specified path.
//
// Return Values: The method MUST return zero on success, or a nonzero error code on
// failure.
//
// +---------------------------------+----------------------------------------------------------------------------------+
// | RETURN | |
// | VALUE/CODE | DESCRIPTION |
// | | |
// +---------------------------------+----------------------------------------------------------------------------------+
// +---------------------------------+----------------------------------------------------------------------------------+
// | 0x80070057 E_INVALIDARG | The quotas parameter is NULL. |
// +---------------------------------+----------------------------------------------------------------------------------+
// | 0x80045311 FSRM_E_NOT_SUPPORTED | The options parameter contains invalid FsrmEnumOptions (section 2.2.1.2.5) |
// | | values. |
// +---------------------------------+----------------------------------------------------------------------------------+
EnumQuotas(context.Context, *EnumQuotasRequest) (*EnumQuotasResponse, error)
// The EnumAutoApplyQuotas method returns all the auto apply quotas from the List of
// Persisted Auto Apply Quotas (section 3.2.1.2) that fall under the specified path.
//
// Return Values: The method MUST return zero on success, or a nonzero error code on
// failure.
//
// +---------------------------------+----------------------------------------------------------------------------------+
// | RETURN | |
// | VALUE/CODE | DESCRIPTION |
// | | |
// +---------------------------------+----------------------------------------------------------------------------------+
// +---------------------------------+----------------------------------------------------------------------------------+
// | 0x80070057 E_INVALIDARG | The quotas parameter is NULL. |
// +---------------------------------+----------------------------------------------------------------------------------+
// | 0x80045311 FSRM_E_NOT_SUPPORTED | The options parameter contains invalid FsrmEnumOptions (section 2.2.1.2.5) |
// | | values. |
// +---------------------------------+----------------------------------------------------------------------------------+
EnumAutoApplyQuotas(context.Context, *EnumAutoApplyQuotasRequest) (*EnumAutoApplyQuotasResponse, error)
// The EnumEffectiveQuotas method returns all the directory quotas from the List of
// Persisted Directory Quotas (section 3.2.1.2) that affect the specified path.
//
// Return Values: The method MUST return zero on success, or a nonzero error code on
// failure.
//
// +---------------------------------+----------------------------------------------------------------------------------+
// | RETURN | |
// | VALUE/CODE | DESCRIPTION |
// | | |
// +---------------------------------+----------------------------------------------------------------------------------+
// +---------------------------------+----------------------------------------------------------------------------------+
// | 0x80070057 E_INVALIDARG | The quotas parameter is NULL. |
// +---------------------------------+----------------------------------------------------------------------------------+
// | 0x80045311 FSRM_E_NOT_SUPPORTED | The options parameter contains invalid FsrmEnumOptions (section 2.2.1.2.5) |
// | | values. |
// +---------------------------------+----------------------------------------------------------------------------------+
EnumEffectiveQuotas(context.Context, *EnumEffectiveQuotasRequest) (*EnumEffectiveQuotasResponse, error)
// The Scan method starts a quota scan on the specified path.
//
// Return Values: The method MUST return zero on success, or a nonzero error code on
// failure.
//
// +--------------------------------+----------------------------------------------------------------------------------+
// | RETURN | |
// | VALUE/CODE | DESCRIPTION |
// | | |
// +--------------------------------+----------------------------------------------------------------------------------+
// +--------------------------------+----------------------------------------------------------------------------------+
// | 0x80045301 FSRM_E_NOT_FOUND | A quota for the specified path could not be found. |
// +--------------------------------+----------------------------------------------------------------------------------+
// | 0x80045306 FSRM_E_INVALID_PATH | The content of the strPath parameter exceeds the maximum length of 260 |
// | | characters. |
// +--------------------------------+----------------------------------------------------------------------------------+
// | 0x80070057 E_INVALIDARG | The strPath parameter is NULL or empty. |
// +--------------------------------+----------------------------------------------------------------------------------+
Scan(context.Context, *ScanRequest) (*ScanResponse, error)
// The CreateQuotaCollection method creates an empty collection for callers to add quotas
// to.
//
// Return Values: The method MUST return zero on success, or a nonzero error code on
// failure.
//
// +-------------------------+-----------------------------------+
// | RETURN | |
// | VALUE/CODE | DESCRIPTION |
// | | |
// +-------------------------+-----------------------------------+
// +-------------------------+-----------------------------------+
// | 0x80070057 E_INVALIDARG | The collection parameter is NULL. |
// +-------------------------+-----------------------------------+
CreateQuotaCollection(context.Context, *CreateQuotaCollectionRequest) (*CreateQuotaCollectionResponse, error)
}
func RegisterQuotaManagerServer(conn dcerpc.Conn, o QuotaManagerServer, opts ...dcerpc.Option) {
conn.RegisterServer(NewQuotaManagerServerHandle(o), append(opts, dcerpc.WithAbstractSyntax(QuotaManagerSyntaxV0_0))...)
}
func NewQuotaManagerServerHandle(o QuotaManagerServer) dcerpc.ServerHandle {
return func(ctx context.Context, opNum int, r ndr.Reader) (dcerpc.Operation, error) {
return QuotaManagerServerHandle(ctx, o, opNum, r)
}
}
func QuotaManagerServerHandle(ctx context.Context, o QuotaManagerServer, opNum int, r ndr.Reader) (dcerpc.Operation, error) {
if opNum < 7 {
// IDispatch base method.
return idispatch.DispatchServerHandle(ctx, o, opNum, r)
}
switch opNum {
case 7: // ActionVariables
in := &GetActionVariablesRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.GetActionVariables(ctx, in)
return resp.xxx_ToOp(ctx), err
case 8: // ActionVariableDescriptions
in := &GetActionVariableDescriptionsRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.GetActionVariableDescriptions(ctx, in)
return resp.xxx_ToOp(ctx), err
case 9: // CreateQuota
in := &CreateQuotaRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.CreateQuota(ctx, in)
return resp.xxx_ToOp(ctx), err
case 10: // CreateAutoApplyQuota
in := &CreateAutoApplyQuotaRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.CreateAutoApplyQuota(ctx, in)
return resp.xxx_ToOp(ctx), err
case 11: // GetQuota
in := &GetQuotaRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.GetQuota(ctx, in)
return resp.xxx_ToOp(ctx), err
case 12: // GetAutoApplyQuota
in := &GetAutoApplyQuotaRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.GetAutoApplyQuota(ctx, in)
return resp.xxx_ToOp(ctx), err
case 13: // GetRestrictiveQuota
in := &GetRestrictiveQuotaRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.GetRestrictiveQuota(ctx, in)
return resp.xxx_ToOp(ctx), err
case 14: // EnumQuotas
in := &EnumQuotasRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.EnumQuotas(ctx, in)
return resp.xxx_ToOp(ctx), err
case 15: // EnumAutoApplyQuotas
in := &EnumAutoApplyQuotasRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.EnumAutoApplyQuotas(ctx, in)
return resp.xxx_ToOp(ctx), err
case 16: // EnumEffectiveQuotas
in := &EnumEffectiveQuotasRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.EnumEffectiveQuotas(ctx, in)
return resp.xxx_ToOp(ctx), err
case 17: // Scan
in := &ScanRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.Scan(ctx, in)
return resp.xxx_ToOp(ctx), err
case 18: // CreateQuotaCollection
in := &CreateQuotaCollectionRequest{}
if err := in.UnmarshalNDR(ctx, r); err != nil {
return nil, err
}
resp, err := o.CreateQuotaCollection(ctx, in)
return resp.xxx_ToOp(ctx), err
}
return nil, nil
}