Commit 15b2d2bb authored by Ralf Habacker's avatar Ralf Habacker

Rename the term 'unix_pid' to 'pid' in variables and functions.

Windows also has numeric process IDs that fit in an unsigned long, so
there's no reason this has to be Unix-specific.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61787Reviewed-by: default avatarSimon McVittie <simon.mcvittie@collabora.co.uk>
parent 73df9770
......@@ -223,7 +223,7 @@ auth_set_unix_credentials(DBusAuth *auth,
if (uid != DBUS_UID_UNSET)
_dbus_credentials_add_unix_uid (credentials, uid);
if (pid != DBUS_PID_UNSET)
_dbus_credentials_add_unix_pid (credentials, pid);
_dbus_credentials_add_pid (credentials, pid);
_dbus_auth_set_credentials (auth, credentials);
......
......@@ -40,7 +40,7 @@
static DBusCredentials*
make_credentials(dbus_uid_t unix_uid,
dbus_pid_t unix_pid,
dbus_pid_t pid,
const char *windows_sid)
{
DBusCredentials *credentials;
......@@ -56,9 +56,9 @@ make_credentials(dbus_uid_t unix_uid,
}
}
if (unix_pid != DBUS_PID_UNSET)
if (pid != DBUS_PID_UNSET)
{
if (!_dbus_credentials_add_unix_pid (credentials, unix_pid))
if (!_dbus_credentials_add_pid (credentials, pid))
{
_dbus_credentials_unref (credentials);
return NULL;
......@@ -102,7 +102,7 @@ _dbus_credentials_test (const char *test_data_dir)
_dbus_assert (_dbus_credentials_include (creds, DBUS_CREDENTIAL_WINDOWS_SID));
_dbus_assert (_dbus_credentials_get_unix_uid (creds) == 12);
_dbus_assert (_dbus_credentials_get_unix_pid (creds) == 511);
_dbus_assert (_dbus_credentials_get_pid (creds) == 511);
_dbus_assert (strcmp (_dbus_credentials_get_windows_sid (creds), SAMPLE_SID) == 0);
_dbus_assert (!_dbus_credentials_are_empty (creds));
......@@ -118,7 +118,7 @@ _dbus_credentials_test (const char *test_data_dir)
_dbus_assert (_dbus_credentials_include (creds2, DBUS_CREDENTIAL_WINDOWS_SID));
_dbus_assert (_dbus_credentials_get_unix_uid (creds2) == 12);
_dbus_assert (_dbus_credentials_get_unix_pid (creds2) == 511);
_dbus_assert (_dbus_credentials_get_pid (creds2) == 511);
_dbus_assert (strcmp (_dbus_credentials_get_windows_sid (creds2), SAMPLE_SID) == 0);
_dbus_assert (_dbus_credentials_are_superset (creds, creds2));
......@@ -192,7 +192,7 @@ _dbus_credentials_test (const char *test_data_dir)
_dbus_assert (!_dbus_credentials_include (creds, DBUS_CREDENTIAL_WINDOWS_SID));
_dbus_assert (_dbus_credentials_get_unix_uid (creds) == DBUS_UID_UNSET);
_dbus_assert (_dbus_credentials_get_unix_pid (creds) == DBUS_PID_UNSET);
_dbus_assert (_dbus_credentials_get_pid (creds) == DBUS_PID_UNSET);
_dbus_assert (_dbus_credentials_get_windows_sid (creds) == NULL);
_dbus_assert (_dbus_credentials_are_empty (creds));
......
......@@ -48,7 +48,7 @@
struct DBusCredentials {
int refcount;
dbus_uid_t unix_uid;
dbus_pid_t unix_pid;
dbus_pid_t pid;
char *windows_sid;
void *adt_audit_data;
dbus_int32_t adt_audit_data_size;
......@@ -77,7 +77,7 @@ _dbus_credentials_new (void)
creds->refcount = 1;
creds->unix_uid = DBUS_UID_UNSET;
creds->unix_pid = DBUS_PID_UNSET;
creds->pid = DBUS_PID_UNSET;
creds->windows_sid = NULL;
creds->adt_audit_data = NULL;
creds->adt_audit_data_size = 0;
......@@ -146,10 +146,10 @@ _dbus_credentials_unref (DBusCredentials *credentials)
* @returns #FALSE if no memory
*/
dbus_bool_t
_dbus_credentials_add_unix_pid (DBusCredentials *credentials,
dbus_pid_t pid)
_dbus_credentials_add_pid (DBusCredentials *credentials,
dbus_pid_t pid)
{
credentials->unix_pid = pid;
credentials->pid = pid;
return TRUE;
}
......@@ -231,7 +231,7 @@ _dbus_credentials_include (DBusCredentials *credentials,
switch (type)
{
case DBUS_CREDENTIAL_UNIX_PROCESS_ID:
return credentials->unix_pid != DBUS_PID_UNSET;
return credentials->pid != DBUS_PID_UNSET;
case DBUS_CREDENTIAL_UNIX_USER_ID:
return credentials->unix_uid != DBUS_UID_UNSET;
case DBUS_CREDENTIAL_WINDOWS_SID:
......@@ -252,9 +252,9 @@ _dbus_credentials_include (DBusCredentials *credentials,
* @returns UNIX process ID
*/
dbus_pid_t
_dbus_credentials_get_unix_pid (DBusCredentials *credentials)
_dbus_credentials_get_pid (DBusCredentials *credentials)
{
return credentials->unix_pid;
return credentials->pid;
}
/**
......@@ -322,8 +322,8 @@ _dbus_credentials_are_superset (DBusCredentials *credentials,
DBusCredentials *possible_subset)
{
return
(possible_subset->unix_pid == DBUS_PID_UNSET ||
possible_subset->unix_pid == credentials->unix_pid) &&
(possible_subset->pid == DBUS_PID_UNSET ||
possible_subset->pid == credentials->pid) &&
(possible_subset->unix_uid == DBUS_UID_UNSET ||
possible_subset->unix_uid == credentials->unix_uid) &&
(possible_subset->windows_sid == NULL ||
......@@ -345,7 +345,7 @@ dbus_bool_t
_dbus_credentials_are_empty (DBusCredentials *credentials)
{
return
credentials->unix_pid == DBUS_PID_UNSET &&
credentials->pid == DBUS_PID_UNSET &&
credentials->unix_uid == DBUS_UID_UNSET &&
credentials->windows_sid == NULL &&
credentials->adt_audit_data == NULL;
......@@ -410,9 +410,9 @@ _dbus_credentials_add_credential (DBusCredentials *credentials,
DBusCredentials *other_credentials)
{
if (which == DBUS_CREDENTIAL_UNIX_PROCESS_ID &&
other_credentials->unix_pid != DBUS_PID_UNSET)
other_credentials->pid != DBUS_PID_UNSET)
{
if (!_dbus_credentials_add_unix_pid (credentials, other_credentials->unix_pid))
if (!_dbus_credentials_add_pid (credentials, other_credentials->pid))
return FALSE;
}
else if (which == DBUS_CREDENTIAL_UNIX_USER_ID &&
......@@ -445,7 +445,7 @@ _dbus_credentials_add_credential (DBusCredentials *credentials,
void
_dbus_credentials_clear (DBusCredentials *credentials)
{
credentials->unix_pid = DBUS_PID_UNSET;
credentials->pid = DBUS_PID_UNSET;
credentials->unix_uid = DBUS_UID_UNSET;
dbus_free (credentials->windows_sid);
credentials->windows_sid = NULL;
......@@ -523,9 +523,9 @@ _dbus_credentials_to_string_append (DBusCredentials *credentials,
goto oom;
join = TRUE;
}
if (credentials->unix_pid != DBUS_PID_UNSET)
if (credentials->pid != DBUS_PID_UNSET)
{
if (!_dbus_string_append_printf (string, "%spid=" DBUS_PID_FORMAT, join ? " " : "", credentials->unix_pid))
if (!_dbus_string_append_printf (string, "%spid=" DBUS_PID_FORMAT, join ? " " : "", credentials->pid))
goto oom;
join = TRUE;
}
......
......@@ -41,7 +41,7 @@ DBusCredentials* _dbus_credentials_new_from_current_process (void);
DBusCredentials* _dbus_credentials_new (void);
void _dbus_credentials_ref (DBusCredentials *credentials);
void _dbus_credentials_unref (DBusCredentials *credentials);
dbus_bool_t _dbus_credentials_add_unix_pid (DBusCredentials *credentials,
dbus_bool_t _dbus_credentials_add_pid (DBusCredentials *credentials,
dbus_pid_t pid);
dbus_bool_t _dbus_credentials_add_unix_uid (DBusCredentials *credentials,
dbus_uid_t uid);
......@@ -52,7 +52,7 @@ dbus_bool_t _dbus_credentials_add_adt_audit_data (DBusCredentials
dbus_int32_t size);
dbus_bool_t _dbus_credentials_include (DBusCredentials *credentials,
DBusCredentialType type);
dbus_pid_t _dbus_credentials_get_unix_pid (DBusCredentials *credentials);
dbus_pid_t _dbus_credentials_get_pid (DBusCredentials *credentials);
dbus_uid_t _dbus_credentials_get_unix_uid (DBusCredentials *credentials);
const char* _dbus_credentials_get_windows_sid (DBusCredentials *credentials);
void * _dbus_credentials_get_adt_audit_data (DBusCredentials *credentials);
......
......@@ -1863,7 +1863,7 @@ _dbus_read_credentials_socket (int client_fd,
if (pid_read != DBUS_PID_UNSET)
{
if (!_dbus_credentials_add_unix_pid (credentials, pid_read))
if (!_dbus_credentials_add_pid (credentials, pid_read))
{
_DBUS_SET_OOM (error);
return FALSE;
......@@ -2318,7 +2318,7 @@ _dbus_credentials_add_from_current_process (DBusCredentials *credentials)
_dbus_assert (sizeof (uid_t) <= sizeof (dbus_uid_t));
_dbus_assert (sizeof (gid_t) <= sizeof (dbus_gid_t));
if (!_dbus_credentials_add_unix_pid(credentials, _dbus_getpid()))
if (!_dbus_credentials_add_pid(credentials, _dbus_getpid()))
return FALSE;
if (!_dbus_credentials_add_unix_uid(credentials, _dbus_geteuid()))
return FALSE;
......
......@@ -1794,7 +1794,7 @@ _dbus_credentials_add_from_current_process (DBusCredentials *credentials)
if (!_dbus_getsid(&sid))
goto failed;
if (!_dbus_credentials_add_unix_pid(credentials, _dbus_getpid()))
if (!_dbus_credentials_add_pid (credentials, _dbus_getpid()))
goto failed;
if (!_dbus_credentials_add_windows_sid (credentials,sid))
......
......@@ -1337,7 +1337,7 @@ _dbus_transport_get_unix_process_id (DBusTransport *transport,
if (_dbus_credentials_include (auth_identity,
DBUS_CREDENTIAL_UNIX_PROCESS_ID))
{
*pid = _dbus_credentials_get_unix_pid (auth_identity);
*pid = _dbus_credentials_get_pid (auth_identity);
return TRUE;
}
else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment