bus: implement server mode, and anonymous authentication

This commit is contained in:
Lennart Poettering
2013-03-30 15:21:55 +01:00
parent a3de5ae1d7
commit 2181a7f558
9 changed files with 454 additions and 43 deletions
+26
View File
@@ -1069,6 +1069,32 @@ char *hexmem(const void *p, size_t l) {
return r;
}
void *unhexmem(const char *p, size_t l) {
uint8_t *r, *z;
const char *x;
assert(p);
z = r = malloc((l + 1) / 2 + 1);
if (!r)
return NULL;
for (x = p; x < p + l; x += 2) {
int a, b;
a = unhexchar(x[0]);
if (x+1 < p + l)
b = unhexchar(x[1]);
else
b = 0;
*(z++) = (uint8_t) a << 4 | (uint8_t) b;
}
*z = 0;
return r;
}
char octchar(int x) {
return '0' + (x & 7);
}
+2
View File
@@ -609,5 +609,7 @@ static inline void *mempset(void *s, int c, size_t n) {
}
char *hexmem(const void *p, size_t l);
void *unhexmem(const char *p, size_t l);
char *strextend(char **x, ...);
char *strrep(const char *s, unsigned n);