MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / filter_acl

Function filter_acl

src/jrd/filters.cpp:154–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152
153
154ISC_STATUS filter_acl(USHORT action, BlobControl* control)
155{
156/**************************************
157 *
158 * f i l t e r _ a c l
159 *
160 **************************************
161 *
162 * Functional description
163 * Get next segment from a access control list.
164 *
165 **************************************/
166 if (action != isc_blob_filter_open)
167 return string_filter(action, control);
168
169 // Initialize for retrieval
170 UCHAR buffer[BUFFER_MEDIUM];
171 const SLONG l = control->ctl_handle->ctl_total_length;
172 UCHAR* const temp = (l <= (SLONG) sizeof(buffer)) ? buffer : (UCHAR*) gds__alloc((SLONG) l);
173 // FREE: at procedure exit
174 UCHAR* p = temp;
175 if (!p) // NOMEM:
176 return isc_virmemexh;
177
178 USHORT length;
179 const ISC_STATUS status = caller(isc_blob_filter_get_segment, control, (USHORT) l, temp, &length);
180
181 TEXT line[BUFFER_SMALL];
182
183 if (!status)
184 {
185 sprintf(line, "ACL version %d", (int) *p++);
186 string_put(control, line);
187 TEXT* out = line;
188
189 bool all_wild;
190 UCHAR c;
191 while (c = *p++)
192 {
193 switch (c)
194 {
195 case ACL_id_list:
196 all_wild = true;
197 *out++ = '\t';
198 while ((c = *p++) != 0)
199 {
200 all_wild = false;
201 sprintf(out, "%s%.*s, ", acl_ids[c], *p, p + 1);
202 p += *p + 1;
203 while (*out)
204 ++out;
205 }
206 if (all_wild)
207 {
208 sprintf(out, "all users: %s, ", WILD_CARD_UIC);
209 while (*out)
210 ++out;
211 }

Callers

nothing calls this directly

Calls 3

string_filterFunction · 0.85
string_putFunction · 0.85
callerFunction · 0.70

Tested by

no test coverage detected