}
uid_t DbAdapter::convertToUid(const char* user) {
+ long val = -1;
errno = 0;
- long val = std::strtol(user, NULL, 10);
- if (!errno)
+ val = std::strtol(user, NULL, 10);
+ if (!errno && (val != 0 ))
+ return (uid_t)val;
+ if ((val == 0 && user[0] == '0' && user[1] == 0))
return (uid_t)val;
struct passwd pwent;
}
gid_t DbAdapter::convertToGid(const char* group) {
+ long val = -1;
errno = 0;
- long val = std::strtol(group, NULL, 10);
- if (!errno)
+ val = std::strtol(group, NULL, 10);
+ if (!errno && (val != 0))
+ return (gid_t)val;
+ if ((val == 0 && group[0] == '0' && group[1] == 0))
return (gid_t)val;
+
struct group grent;
struct group *gg;
char buf[1024];