this repo has no description
1#include <unistd.h>
2#include <sys/types.h>
3#include <stdlib.h>
4#include <pwd.h>
5#include <sys/utsname.h>
6//#include "log.h"
7
8#include <CoreFoundation/CFString.h>
9#include <SystemConfiguration/SCDynamicStoreCopySpecific.h>
10
11#define MAX_PASSENTRY_LENGTH 4096
12
13CFStringRef SCDynamicStoreCopyComputerName (SCDynamicStoreRef store, CFStringEncoding *nameEncoding){
14 //LOG << "fixme: SCDynamicStoreCopyComputerName() - stub" << std::endl;
15 return NULL;
16}
17
18CFStringRef SCDynamicStoreCopyConsoleUser (SCDynamicStoreRef store, uid_t *uid, gid_t *gid){
19 struct passwd pwent, *pwentp;
20 char buffer[MAX_PASSENTRY_LENGTH];
21 char *user;
22
23 if (uid) *uid = getuid();
24 if (gid) *gid = getgid();
25
26 user = getenv("USER");
27 if (user)
28 return CFStringCreateWithCString(NULL, user, kCFStringEncodingUTF8);
29
30 if (getpwuid_r(getuid(), &pwent, buffer, MAX_PASSENTRY_LENGTH, &pwentp))
31 return CFStringCreateWithCString(NULL, pwentp->pw_name, kCFStringEncodingUTF8);
32
33 return NULL;
34}
35
36CFStringRef SCDynamicStoreCopyLocalHostName (SCDynamicStoreRef store){
37 struct utsname info;
38
39 if (uname(&info) != 0)
40 return NULL;
41
42 return CFStringCreateWithCString(NULL, info.nodename, kCFStringEncodingUTF8);
43}
44
45CFStringRef SCDynamicStoreCopyLocation (SCDynamicStoreRef store){
46 //LOG << "fixme: SCDynamicStoreCopyLocation() - stub" << std::endl;
47 return NULL;
48}
49
50CFDictionaryRef SCDynamicStoreCopyProxies (SCDynamicStoreRef store){
51 //LOG << "fixme: SCDynamicStoreCopyComputerName() - stub" << std::endl;
52 /* No Proxy support yet */
53 return NULL;
54}