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

Function ISC_get_user

src/common/isc.cpp:329–366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

327
328#ifdef UNIX
329bool ISC_get_user(Firebird::string* name, int* id, int* group)
330{
331/**************************************
332 *
333 * I S C _ g e t _ u s e r ( U N I X )
334 *
335 **************************************
336 *
337 * Functional description
338 * Find out who the user is.
339 *
340 **************************************/
341 // egid and euid need to be signed, uid_t is unsigned on SUN!
342 SLONG egid, euid;
343 const TEXT* p = NULL;
344
345 euid = (SLONG) geteuid();
346 egid = (SLONG) getegid();
347 const struct passwd* password = getpwuid(euid);
348 if (password)
349 p = password->pw_name;
350 else
351 p = "";
352#ifndef ANDROID // Why do they print silly unimplemented message for this function?
353 endpwent();
354#endif
355
356 if (name)
357 *name = p;
358
359 if (id)
360 *id = euid;
361
362 if (group)
363 *group = egid;
364
365 return (euid == 0);
366}
367#endif
368
369

Callers 4

INET_analyzeFunction · 0.85
XNET_analyzeFunction · 0.85
getUserInfoFunction · 0.85
ServiceMethod · 0.85

Calls 2

recalculate_lengthMethod · 0.80
getBufferMethod · 0.45

Tested by

no test coverage detected