return configdata;
}
+
+
+string
+username(uid_t uid)
+{
+ string username;
+ gid_t gid;
+
+ if (!get_uid_username_gid(uid, username, gid))
+ return sformat("unknown (%d)", uid);
+
+ return username;
+}
map<string, string>
read_configdata(const list<string>& l, const map<string, string>& old = map<string, string>());
+string
+username(uid_t uid);
- also handle primary group of user when checking permissions
(see gh#openSUSE/snapper#100)
+- show id of user if namename cannot be detected
-------------------------------------------------------------------
Fri Jul 25 12:38:33 CEST 2014 - aschnell@suse.de
}
- string
- username(uid_t uid)
- {
- struct passwd pwd;
- struct passwd* result;
-
- long bufsize = sysconf(_SC_GETPW_R_SIZE_MAX);
- char buf[bufsize];
-
- if (getpwuid_r(uid, &pwd, buf, bufsize, &result) != 0 || result != &pwd)
- return "unknown";
-
- memset(pwd.pw_passwd, 0, strlen(pwd.pw_passwd));
-
- return pwd.pw_name;
- }
-
-
bool
get_uid_username_gid(uid_t uid, string& username, gid_t& gid)
{
string datetime(time_t time, bool utc, bool classic);
time_t scan_datetime(const string& str, bool utc);
- string username(uid_t uid);
bool get_uid_username_gid(uid_t uid, string& username, gid_t& gid);
bool get_user_uid(const char* username, uid_t& uid);
bool get_group_gid(const char* groupname, gid_t& gid);