summaryrefslogtreecommitdiffstats
path: root/src/detection/host/host_nbsd.c
blob: a5a29d28907538502012f35057c34a1a822baaf7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "host.h"
#include "common/sysctl.h"
#include "common/smbios.h"

const char* ffDetectHost(FFHostResult* host) {
    const char* error = NULL;
    if ((error = ffSysctlGetString("machdep.dmi.system-product", &host->name))) {
        return error;
    }
    ffCleanUpSmbiosValue(&host->name);
    if (ffSysctlGetString("machdep.dmi.system-vendor", &host->vendor) == NULL) {
        ffCleanUpSmbiosValue(&host->vendor);
    }
    if (ffSysctlGetString("machdep.dmi.system-version", &host->version) == NULL) {
        ffCleanUpSmbiosValue(&host->version);
    }
    if (ffSysctlGetString("machdep.dmi.system-serial", &host->serial) == NULL) {
        ffCleanUpSmbiosValue(&host->serial);
    }
    if (ffSysctlGetString("machdep.dmi.system-uuid", &host->uuid) == NULL) {
        ffCleanUpSmbiosValue(&host->uuid);
    }

    return NULL;
}