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

const char* ffDetectHost(FFHostResult* host) {
    const char* error = NULL;
    if ((error = ffSysctlGetString(CTL_HW, HW_PRODUCT, &host->name))) {
        return error;
    }
    ffCleanUpSmbiosValue(&host->name);
    if (ffSysctlGetString(CTL_HW, HW_VENDOR, &host->vendor) == NULL) {
        ffCleanUpSmbiosValue(&host->vendor);
    }
    if (ffSysctlGetString(CTL_HW, HW_VERSION, &host->version) == NULL) {
        ffCleanUpSmbiosValue(&host->version);
    }
    if (ffSysctlGetString(CTL_HW, HW_SERIALNO, &host->serial) == NULL) {
        ffCleanUpSmbiosValue(&host->serial);
    }

    return NULL;
}