2 * Unix SMB/CIFS implementation.
4 * Window Search Service
6 * Copyright (c) Noel Power
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, see <http://www.gnu.org/licenses/>.
22 #include "librpc/wsp/wsp_util.h"
23 #include "librpc/gen_ndr/wsp.h"
25 const struct full_propset_info
*get_propset_info_with_guid(
26 const char *prop_name
,
27 struct GUID
*propset_guid
)
30 const struct full_guid_propset
*guid_propset
= NULL
;
31 const struct full_propset_info
*result
= NULL
;
32 for (i
= 0; full_propertyset
[i
].prop_info
!= NULL
; i
++) {
33 const struct full_propset_info
*item
= NULL
;
34 guid_propset
= &full_propertyset
[i
];
35 item
= guid_propset
->prop_info
;
37 if (strequal(prop_name
, item
->name
)) {
38 *propset_guid
= guid_propset
->guid
;
51 const struct full_propset_info
*get_prop_info(const char *prop_name
)
53 const struct full_propset_info
*result
= NULL
;
55 result
= get_propset_info_with_guid(prop_name
, &guid
);
59 char *prop_from_fullprop(TALLOC_CTX
*ctx
, struct wsp_cfullpropspec
*fullprop
)
63 const struct full_propset_info
*item
= NULL
;
64 bool search_by_id
= (fullprop
->ulkind
== PRSPEC_PROPID
);
66 for (i
= 0; full_propertyset
[i
].prop_info
!= NULL
; i
++) {
68 if (GUID_equal(&fullprop
->guidpropset
,
69 &full_propertyset
[i
].guid
)) {
70 item
= full_propertyset
[i
].prop_info
;
77 if( fullprop
->name_or_id
.prspec
== item
->id
) {
78 result
= talloc_strdup(ctx
, item
->name
);
81 } else if (strcmp(item
->name
,
82 fullprop
->name_or_id
.propname
.vstring
)
84 result
= talloc_strdup(ctx
, item
->name
);
92 result
= GUID_string(ctx
, &fullprop
->guidpropset
);
95 result
= talloc_asprintf(result
, "%s/%d", result
,
96 fullprop
->name_or_id
.prspec
);
98 result
= talloc_asprintf(result
, "%s/%s", result
,
99 fullprop
->name_or_id
.propname
.vstring
);
105 struct wsp_cfullpropspec
*get_full_prop(struct wsp_crestriction
*restriction
)
107 struct wsp_cfullpropspec
*result
;
108 switch (restriction
->ultype
) {
110 result
= &restriction
->restriction
.cpropertyrestriction
.property
;
113 result
= &restriction
->restriction
.ccontentrestriction
.property
;
116 result
= &restriction
->restriction
.cnatlanguagerestriction
.property
;