| 327 | |
| 328 | #ifdef UNIX |
| 329 | bool 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 |
no test coverage detected