MCPcopy Create free account
hub / github.com/KDE/kdevelop / getAuthToken

Function getAuthToken

kdevplatform/util/dbus_socket_transformer/main.cpp:54–76  ·  view source on GitHub ↗

* Returns the valid dbus EXTERNAL authentication token for the current user (see above) * */

Source from the content-addressed store, hash-verified

52 * Returns the valid dbus EXTERNAL authentication token for the current user (see above)
53 * */
54std::string getAuthToken()
55{
56 // Get uid
57 int uid = getuid();
58
59 std::ostringstream uidStream;
60 uidStream << uid;
61
62 std::string uidStr = uidStream.str();
63
64 const char hexdigits[16] = {
65 '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
66 'a', 'b', 'c', 'd', 'e', 'f'
67 };
68
69 std::ostringstream hexStream;
70 for (char c : uidStr) {
71 auto byte = (unsigned char)c;
72 hexStream << hexdigits[byte >> 4] << hexdigits[byte & 0x0f];
73 }
74
75 return hexStream.str();
76}
77
78/**
79 * Shuffles all data between the two file-descriptors until one of them fails or reaches EOF.

Callers 1

shuffleBetweenStreamsFunction · 0.85

Calls 1

strMethod · 0.80

Tested by

no test coverage detected