Overview of pkg-lib-macosx.inc

Public Function Summary

Public functions are intended to be called by the code that imports this library.

Name Summary
isosxpkgvuln
osx_rls_name
osx_ver
pkg_in_list
rlsnotsupported

Public Function Details

isosxpkgvuln

Named Parameters

diff
fixed

Code

function isosxpkgvuln(fixed, diff) {
    list=get_kb_item("ssh/login/osx_pkgs");
    if (!list) exit (0);
    max_diff=0;
    list=split(list);
    foreach i (keys(list)) if (fixed >< chomp(list[i])) {
        s=(substr(chomp(list[i]), strlen(fixed), strlen(fixed)+strlen(diff)-1));
        if (s>max_diff) {max_diff = s;}
    }
    if (diff>max_diff) return 1; else return 0;
}

# Checks if pkg name exists in pkg list #

		
top

osx_rls_name

Named Parameters

rls

Code

function osx_rls_name(rls) {
    r=eregmatch(pattern:"[a-z A-Z]+[0-9]+\.[0-9]+", string:rls);
    return r[0];
}

# Returns the full (minor) version of Mac OS X #

		
top

osx_ver

Named Parameters

ver

Code

function osx_ver(ver) {
    v=eregmatch(pattern:"[0-9.]+", string:ver);
    return v[0];
}

# Checks if the relase is less than the ones in the list #

		
top

pkg_in_list

Named Parameters

name
version

Code

function pkg_in_list(name, version) {
    list=get_kb_item("ssh/login/osx_pkgs");
    if (!list) exit (0);
    list=split(list);
    foreach i (keys(list)) if (name == chomp(list[i])) {
        if (version == 0 || version == chomp(list[i+1])) return 1;
    }
    return 0;
}

# Returns the release (major) version of Mac OS X #

		
top

rlsnotsupported

Named Parameters

list
rls

Code

function rlsnotsupported(rls, list) {
    min = eregmatch (pattern:"[0-9]+.[0-9]+", string:list[0]);
    foreach ver (list) {
        r = eregmatch(pattern:"[0-9]+.[0-9]+", string:ver);
        if (min[0] > r[0]) { r=min; display (min);}
    }
    rls = eregmatch(pattern:"[0-9]+.[0-9]+", string:rls);
    if (rls[0] < min[0]) return 1; else return 0;
}


		
top