%% options copyright owner = Dirk Krause copyright year = 2012-xxxx license = bsd %% header #include "dk3all.h" /** Computer owner/user. */ typedef struct { char const *us; /**< Short name, login name (primary key). */ char const *tt; /**< Title, academic degree. */ char const *sn; /**< Surname. */ char const *na; /**< Family name. */ char const *em; /**< E-mail address. */ char const *cc; /**< ID in cost controlling. */ char const *si; /**< Staff ID number. */ dk3_sto_t *s_ho; /**< Hosts for user. */ dk3_sto_it_t *i_ho; /**< Iterator for hosts storage. */ dk3_sto_t *s_li; /**< Licenses assigned to user. */ dk3_sto_it_t *i_li; /**< Iterator for licenses storage. */ } itadmin_user; /** Building. */ typedef struct { char const *s; /**< Short name (primary key). */ char const *l; /**< Full building name. */ char const *a1; /**< Address line 1. */ char const *a2; /**< Address line 2. */ char const *a3; /**< Address line 3. */ char const *a4; /**< Address line 4. */ char const *zc; /**< Zip code (german: Postleitzahl). */ char const *city; /**< City/Town name. */ } itadmin_building; /** Speed for network connection. */ typedef struct { char const *s; /**< Short speed name (primary key). */ char const *l; /**< Long speed name (description). */ } itadmin_speed; /** VLAN. */ typedef struct { char const *s; /**< Short VLAN name (primary key). */ char const *l; /**< Long VLAN name (description). */ dk3_sto_t *s_nw; /**< Storage for networks. */ dk3_sto_it_t *i_nw; /**< Iterator through networks storage. */ dk3_sto_t *s_do; /**< DHCP options for VLAN. */ dk3_sto_it_t *i_do; /**< Iterator through DHCP options. */ } itadmin_vlan; /** Network connection socket. */ typedef struct { char const *s; /**< Short name (label on socket, pk). */ char const *hp; /**< Hub port used for socket. */ char const *room; /**< Room name or number in building. */ itadmin_speed *sp; /**< Speed setting for socket. */ itadmin_vlan *vl; /**< VLAN for socket. */ itadmin_building *bu; /**< Building. */ } itadmin_connect; /** Network. */ typedef struct { itadmin_vlan *vl; /**< Parent VLAN. */ dk3_sto_t *s_p; /**< Storage for DHCP pools. */ dk3_sto_it_t *i_p; /**< Iterator through pools storage. */ dk3_sto_t *s_dg; /**< Storage for DHCP groups in network. */ dk3_sto_it_t *i_dg; /**< Iterator through groups in nw storage. */ dk3_sto_t *s_do; /**< DHCP options. */ dk3_sto_it_t *i_do; /**< Iterator for DHCP options. */ dk3_sto_t *s_hoi; /**< Storage for hosts. */ dk3_sto_it_t *i_hoi; /**< Iterator for hosts storage. */ dk3_sto_t *s_dc; /**< DHCP classes for this network. */ dk3_sto_it_t *i_dc; /**< Iterator through DHCP classes storage. */ unsigned long ip4; /**< IPv4 start address (primary key). */ unsigned long ma4; /**< IPv4 network mask. */ unsigned long gw4; /**< IPv4 gateway. */ unsigned long bc4; /**< IPv4 broadcast address. */ } itadmin_network; /** Netgroup. */ typedef struct { char const *sn; /**< Short name (primary key). */ char const *ln; /**< Long name (description). */ size_t no; /**< Netgroup number. */ } itadmin_netgroup; /** Netgroup dependency. */ typedef struct { itadmin_netgroup *pa; /**< Parent group. */ itadmin_netgroup *ch; /**< Child group. */ } itadmin_ngdep; /** DHCP class. */ typedef struct { char const *sn; /**< Short name (primary key). */ char const *ln; /**< Long name (description). */ dk3_sto_t *s_ho; /**< Hosts in this class. */ dk3_sto_it_t *i_ho; /**< Iterator through hosts storage. */ itadmin_network *dhcpn; /**< Network for DHCP hosts. */ } itadmin_dhcp_class; /** DHCP address pool. */ typedef struct { itadmin_network *nw; /**< Network. */ itadmin_dhcp_class *acl; /**< Allowed DHCP class. */ dk3_sto_t *s_do; /**< DHCP options for pool. */ dk3_sto_it_t *i_do; /**< Iterator for DHCP options. */ dk3_sto_t *s_hoi; /**< Hosts storage. */ dk3_sto_it_t *i_hoi; /**< Hosts storage iterator. */ unsigned long ip4s; /**< IPv4 start address. */ unsigned long ip4e; /**< IPv4 end address. */ char duc; /**< Flag: Deny unknown clients. */ char auc; /**< Flag: Allow unknown clients. */ } itadmin_dhcp_pool; /** DHCP group. */ typedef struct { char const *sn; /**< Short group name (primary key). */ char const *ln; /**< Long name (description). */ dk3_sto_t *s_do; /**< DHCP options storage. */ dk3_sto_it_t *i_do; /**< DHCP options iterator. */ } itadmin_dhcp_group; /** DHCP group within a network. */ typedef struct { itadmin_dhcp_group *gr; /**< Group. */ dk3_sto_t *s_h; /**< Storage for hosts in this group. */ dk3_sto_it_t *i_h; /**< Iterator for storage. */ } itadmin_dhcp_ginw; /** Date (used for host expiration). */ typedef struct { int y; /**< Year. */ int m; /**< Month. */ int d; /**< Day in month. */ } itadmin_date; /** Host. */ typedef struct { itadmin_date expi; /**< Expiration date. */ char const *sn; /**< Short host name (primary key). */ char const *co; /**< Comment, description. */ char const *maca; /**< MAC address. */ char const *room; /**< Room within the building. */ char const *inv; /**< Inventory ID. */ char const *serno; /**< Serial number. */ char const *hid; /**< Host ID. */ char const *dnsd; /**< DNS domain. */ itadmin_user *un; /**< System owner. */ itadmin_netgroup *ng; /**< Netgroup. */ itadmin_dhcp_class *dc; /**< DHCP class. */ itadmin_dhcp_group *dg; /**< DHCP group. */ itadmin_dhcp_pool *dp; /**< DHCP pool. */ itadmin_connect *nc; /**< Network connection socket. */ itadmin_building *bu; /**< Building. */ dk3_sto_t *s_al; /**< Storage for aliases. */ dk3_sto_it_t *i_al; /**< Iterator through aliases storage. */ dk3_sto_t *s_do; /**< DHCP options for host. */ dk3_sto_it_t *i_do; /**< DHCP options iterator. */ dk3_sto_t *s_li; /**< Licenses assigned to host. */ dk3_sto_it_t *i_li; /**< Iterator through licenses storage. */ unsigned long ipv4; /**< IPv4 address. */ char fnf; /**< Flag: Full name first in hosts. */ char fgu; /**< Flag: Guest computer. */ char snd; /**< Flag: Skip in network documentation. */ char saw; /**< Flag: Skip in arpwatch configuration. */ } itadmin_host; /** Software manufacturer. */ typedef struct { char const *sn; /**< Short name (primary key). */ char const *ln; /**< Full name. */ } itadmin_swman; /** Software product. */ typedef struct { char const *sn; /**< Short name (primary key). */ char const *ln; /**< Full name. */ itadmin_swman *mn; /**< Software manufacturer. */ } itadmin_swprod; /** License type. */ typedef struct { char const *sn; /**< Short name (primary key). */ char const *ln; /**< Full name. */ int num; /**< Number of client licenses. */ } itadmin_lictype; /** Software license. */ typedef struct { itadmin_date d_del; /**< Delivery date. */ itadmin_date d_inv; /**< Invoice date. */ char const *order; /**< Internal order ID. */ char const *notes; /**< Additional notes about the license. */ char const *i_del; /**< Delivery note ID. */ char const *i_inv; /**< Invoice ID. */ itadmin_swprod *prod; /**< Software product. */ itadmin_lictype *ltype; /**< License type. */ itadmin_user *owner; /**< License owner. */ itadmin_host *host; /**< Host where license is used. */ unsigned long pk; /**< Primary key from database. */ } itadmin_license; /** DHCP option. */ typedef struct { char const *k; /**< Key (option name). */ char const *v; /**< Option value. */ long pk; /**< Primary key from database. */ } itadmin_dhcp_option; /** Job structure for the itadmin program. */ typedef struct { itadmin_date today; /**< Current date. */ dk3_app_t *app; /**< Application structure. */ dk3_option_set_t *opt; /**< Option set. */ dk3_sto_t *s_us; /**< User storage. */ dk3_sto_it_t *i_us; /**< User storage iterator. */ dk3_sto_t *s_usn; /**< User sorted by name. */ dk3_sto_it_t *i_usn; /**< Storage iterator for users by name. */ dk3_sto_t *s_bu; /**< Building storage. */ dk3_sto_it_t *i_bu; /**< Building storage iterator. */ dk3_sto_t *s_sp; /**< Patch speed storage. */ dk3_sto_it_t *i_sp; /**< Patch speed storage iterator. */ dk3_sto_t *s_vl; /**< VLAN storage. */ dk3_sto_it_t *i_vl; /**< VLAN storage iterator. */ dk3_sto_t *s_pa; /**< Network patch storage. */ dk3_sto_it_t *i_pa; /**< Network patch storage iterator. */ dk3_sto_t *s_nw; /**< Network storage. */ dk3_sto_it_t *i_nw; /**< Network storage iterator. */ dk3_sto_t *s_ng; /**< Netgroup storage. */ dk3_sto_it_t *i_ng; /**< Netgroup storage iterator. */ dk3_sto_t *s_nd; /**< Netgroup dependency storage. */ dk3_sto_it_t *i_nd; /**< Netgroup dependency storage iterator. */ dk3_sto_t *s_dc; /**< DHCP class storage. */ dk3_sto_it_t *i_dc; /**< DHCP class storage iterator. */ dk3_sto_t *s_dp; /**< DHCP pool storage. */ dk3_sto_it_t *i_dp; /**< DHCP pool storage iterator. */ dk3_sto_t *s_dg; /**< DHCP group storage. */ dk3_sto_it_t *i_dg; /**< DHCP group storage iterator. */ dk3_sto_t *s_ho; /**< Host storage, sorted by name. */ dk3_sto_it_t *i_ho; /**< Host storage iterator for s_ho. */ dk3_sto_t *s_hoi; /**< Host storage, sorted by IP address. */ dk3_sto_it_t *i_hoi; /**< Host storage iterator for s_hoi. */ dk3_sto_t *s_sm; /**< Software manufacturer storage. */ dk3_sto_it_t *i_sm; /**< Software manufacturer storage iterator. */ dk3_sto_t *s_sw; /**< Software storage. */ dk3_sto_it_t *i_sw; /**< Software storage iterator. */ dk3_sto_t *s_lt; /**< License type storage. */ dk3_sto_it_t *i_lt; /**< License type storage iterator. */ dk3_sto_t *s_lc; /**< Licenses storage. */ dk3_sto_it_t *i_lc; /**< Licenses storage iterator. */ dk3_sto_t *s_lf; /**< Free licenses. */ dk3_sto_it_t *i_lf; /**< Free licenses iterator. */ dk3_sto_t *s_do; /**< DHCP options for entire server. */ dk3_sto_it_t *i_do; /**< Iterator for DHCP options. */ void *dbptr; /**< Database object pointer. */ dk3_bm_t *ngdep; /**< Direct/indirect netgroup dependencies. */ dk3_uc2lat_t *uc2l; /**< Unicode to LaTeX converter. */ dkChar const * const *msg; /**< Localized message texts. */ dkChar const * const *noloc; /**< Texts, not localized. */ dkChar const *dbhn; /**< Database host name. */ dkChar const *dbn; /**< Database name. */ dkChar const *dbcf; /**< Database credentials files. */ dkChar const *dbus; /**< Database user name. */ dkChar const *dbpw; /**< Database password. */ dkChar const *vlan; /**< VLAN name. */ dkChar const *org; /**< Organization name. */ dkChar const *ou; /**< Organizational unit name. */ dkChar const *admn; /**< Administrator name. */ dkChar const *ldapb; /**< LDAP base. */ size_t nng; /**< Number of netgroups. */ int exval; /**< Exit status code. */ int ec; /**< Error code, see @ref errorcodes. */ int cmd; /**< Command to execute. */ int f_dh; /**< Flag: Write dhcpd.conf file. */ int dbt; /**< Database type. */ int gdate; /**< Flag: German date notation. */ int hlh; /**< Flag: Have localhost entry. */ int ukoma; /**< Flag: Use koma-script. */ int rel; /**< Release lease on shutdown. */ } itadmin_job; /** Reader structure for credentials file. */ typedef struct { itadmin_job *job; /**< Job structure. */ int f_clnt; /**< Flag: In client section. */ } itadmin_cred_reader; /** @defgroup itadmincommand Command IDs for itadmin. */ /**@{*/ /** itadmin command: Rebuild configuration and network documentation. */ #define ITADMIN_CMD_CONFIG 1 /** itadmin command: Rebuild license report. */ #define ITADMIN_CMD_LICENSES 2 /** itadmin command: show help text. */ #define ITADMIN_CMD_HELP 4 /** itadmin command: show version information. */ #define ITADMIN_CMD_VERSION 8 /** itadmin command: show license terms. */ #define ITADMIN_CMD_LICENSE_TERMS 16 /**@}*/ /** Maximum size for configuration file lines. */ #define ITADMIN_CONFIG_LINE_SIZE 256 /** Function to remove one object. */ typedef void itadmin_obj_del(void *); #ifdef __cplusplus extern "C" { #endif /** Read configuration file(s). @param job Job structure. @return 1 on success, 0 on error. */ int itadmin_config_read(itadmin_job *job); /** Delete one user. @param v Object to delete. */ void itadmin_mem_user_del(void *v); /** Delete one building. @param v Object to delete. */ void itadmin_mem_building_del(void *v); /** Delete one speed setting. @param v Object to delete. */ void itadmin_mem_speed_del(void *v); /** Delete one VLAN. @param v Object to delete. */ void itadmin_mem_vlan_del(void *v); /** Delete one network connection patch. @param v Object to delete. */ void itadmin_mem_connect_del(void *v); /** Delete one network. @param v Object to delete. */ void itadmin_mem_network_del(void *v); /** Delete one netgroup. @param v Object to delete. */ void itadmin_mem_netgroup_del(void *v); /** Delete one netgroup dependency. @param v Object to delete. */ void itadmin_mem_ngdep_del(void *v); /** Delete one DHCP class. @param v Object to delete. */ void itadmin_mem_dhcp_class_del(void *v); /** Delete one DHCP pool. @param v Object to delete. */ void itadmin_mem_dhcp_pool_del(void *v); /** Delete one DHCP group. @param v Object to delete. */ void itadmin_mem_dhcp_group_del(void *v); /** Delete one host. @param v Object to delete. */ void itadmin_mem_host_del(void *v); /** Delete one software manufacturer. @param v Object to delete. */ void itadmin_mem_sw_man_del(void *v); /** Delete one software product. @param v Object to delete. */ void itadmin_mem_software_del(void *v); /** Delete one license type. @param v Object to delete. */ void itadmin_mem_lic_type_del(void *v); /** Delete one license. @param v Object to delete. */ void itadmin_mem_license_del(void *v); /** Create new user. @param job Job structure. @param un Name. @param tt Academic degree or title (may be NULL). @param sn Surname (may be NULL). @param na Name. @param em E-Mail (may be NULL). @param cc Cost control ID (may be NULL). @param si Staff ID number (may be NULL). @return Pointer to new object on success, NULL on error. */ itadmin_user * itadmin_mem_user_new( itadmin_job *job, char const *un, char const *tt, char const *sn, char const *na, char const *em, char const *cc, char const *si ); /** Create new building. @param job Job structure. @param s Name. @param l Long name (may be NULL). @param a1 Address line 1 (typically street and number, may be NULL). @param a2 Address line 2 (may be NULL). @param a3 Address line 3 (may be NULL). @param a4 Address line 4 (may be NULL). @param zc Zip code (may be NULL). @param city Town or city name (may be NULL). @return Pointer to new object on success, NULL on error. */ itadmin_building * itadmin_mem_building_new( itadmin_job *job, char const *s, char const *l, char const *a1, char const *a2, char const *a3, char const *a4, char const *zc, char const *city ); /** Create new speed setting. @param job Job structure. @param s Name. @param n Description (may be NULL). @return Pointer to new object on success, NULL on error. */ itadmin_speed * itadmin_mem_speed_new( itadmin_job *job, char const *s, char const *n ); /** Create new VLAN. @param job Job structure. @param s Name. @param l Long name (may be NULL). @return Pointer to new object on success, NULL on error. */ itadmin_vlan * itadmin_mem_vlan_new( itadmin_job *job, char const *s, char const *l ); /** Create new network connector. @param job Job structure. @param s Name. @param hp Building. @param room Room. @param sp Speed setting. @param vl VLAN. @param bu Building. @return Pointer to new object on success, NULL on error. */ itadmin_connect * itadmin_mem_connect_new( itadmin_job *job, char const *s, char const *hp, char const *room, itadmin_speed *sp, itadmin_vlan *vl, itadmin_building *bu ); /** Create new network. @param job Job structure. @param ip4 Network address. @param ma4 Network mask. @param gw4 Gateway. @param bc4 Broadcast address. @param vl VLAN. @return Pointer to new object on success, NULL on error. */ itadmin_network * itadmin_mem_network_new( itadmin_job *job, unsigned long ip4, unsigned long ma4, unsigned long gw4, unsigned long bc4, itadmin_vlan *vl ); /** Create new netgroup. @param job Job structure. @param sn Short name. @param ln Long name (may be NULL). @return Pointer to new object on success, NULL on error. */ itadmin_netgroup * itadmin_mem_netgroup_new( itadmin_job *job, char const *sn, char const *ln ); /** Create new netgroup dependency. @param job Job structure. @param pa Parent group. @param ch Child group. @return Pointer to new object on success, NULL on error. */ itadmin_ngdep * itadmin_mem_ngdep_new( itadmin_job *job, itadmin_netgroup *pa, itadmin_netgroup *ch ); /** Create new DHCP class. @param job Job structure. @param sn Short name. @param ln Long name (may be NULL). @return Pointer to new object on success, NULL on error. */ itadmin_dhcp_class * itadmin_mem_dhcp_class_new( itadmin_job *job, char const *sn, char const *ln ); /** Create new DHCP pool. @param job Job structure. @param nw Network. @param cn Allowed class (if unknown clients are denied, may be NULL). @param ip4s IPv4 start address. @param ip4e IPv4 end address. @param duc Flag: Deny unknown clients (needs cn). @param auc Flag: Allow unknown clients. @return Pointer to new object on success, NULL on error. */ itadmin_dhcp_pool * itadmin_mem_dhcp_pool_new( itadmin_job *job, itadmin_network *nw, itadmin_dhcp_class *cn, unsigned long ip4s, unsigned long ip4e, int duc, int auc ); /** Create new DHCP group. @param job Job structure. @param sn Short name. @param ln Long name (may be NULL). @return Pointer to new object on success, NULL on error. */ itadmin_dhcp_group * itadmin_mem_dhcp_group_new( itadmin_job *job, char const *sn, char const *ln ); /** Create new host @param job Job structure. @param sn Short name. @param co Comment/description (may be NULL). @param maca MAC address (may be NULL). @param room Room (may be NULL). @param inv Inventory number (may be NULL). @param serno Serial number (may be NULL). @param hid Host ID (may be NULL). @param expi Expiration date (may be NULL). @param dnsd DNS domain (may be NULL). @param un System owner. @param ng Netgroup (may be NULL). @param dc DHCP class (may be NULL). @param dg DHCP group (may be NULL). @param nc Network connection socket (may be NULL). @param bu Building (may be NULL). @param ipv4 IPv4 address (may be NULL). @param fnf Flag: FQDN first in hosts file. @param fgu Flag: Guest computer (bring your own device). @param snd Flag: Skip in network documentation. @param saw Flag: Skip in arpwatch configuration. @return Pointer to new object on success, NULL on error. */ itadmin_host * itadmin_mem_host_new( itadmin_job *job, itadmin_date *expi, char const *sn, char const *co, char const *maca, char const *room, char const *inv, char const *serno, char const *hid, char const *dnsd, itadmin_user *un, itadmin_netgroup *ng, itadmin_dhcp_class *dc, itadmin_dhcp_group *dg, itadmin_connect *nc, itadmin_building *bu, unsigned long ipv4, int fnf, int fgu, int snd, int saw ); /** Create new software manufacturer. @param job Job structure. @param sn Short name. @param ln Long name (description). @return Pointer to new object on success, NULL on error. */ itadmin_swman * itadmin_mem_sw_man_new( itadmin_job *job, char const *sn, char const *ln ); /** Create new software product. @param job Job structure. @param sn Short name. @param ln Long name. @param mn Software manufacturer name (may be NULL). @return Pointer to new object on success, NULL on error. */ itadmin_swprod * itadmin_mem_swprod_new( itadmin_job *job, char const *sn, char const *ln, itadmin_swman *mn ); /** Create new license type. @param job Job structure. @param sn Short license type name. @param ln Long name (description). @param num Number of client licenses for floating license servers. @return Pointer to new object on success, NULL on error. */ itadmin_lictype * itadmin_mem_lictype_new( itadmin_job *job, char const *sn, char const *ln, int num ); /** Create new license. @param job Job structure. @param pk Primary key from licenses table (unused). @param order Order ID or tracking information (may be NULL). @param notes Additional notes (may be NULL). @param d_del Delivery date (may be NULL). @param i_del Delivery note ID (may be NULL). @param d_inv Invoice date (may be NULL). @param i_inv Invoice ID (may be NULL). @param prod Software product. @param ltype License type. @param owner License owner (may be NULL). @param host Computer (may be NULL). @return Pointer to new object on success, NULL on error. */ itadmin_license * itadmin_mem_license_new( itadmin_job *job, unsigned long pk, char const *order, char const *notes, itadmin_date *d_del, char const *i_del, itadmin_date *d_inv, char const *i_inv, itadmin_swprod *prod, itadmin_lictype *ltype, itadmin_user *owner, itadmin_host *host ); /** Create new DHCP group in network. @param job Job structure. @param gr DHCP group structure. @return Pointer to new object on success, NULL on error. */ itadmin_dhcp_ginw * itadmin_mem_dhcp_ginw_new(itadmin_job *job, itadmin_dhcp_group *gr); /** Destroy DHCP group in network structure, release memory. @param g Group structure to destroy. */ void itadmin_mem_dhcp_ginw_del(itadmin_dhcp_ginw *g); /** Initialize date structure. @param dp Date pointer. */ void itadmin_mem_date_init(itadmin_date *dp); /** Copy date structure. @param dp Destination pointer. @param sp Source pointer. */ void itadmin_mem_date_copy(itadmin_date *dp, itadmin_date *sp); /** Create a DHCP option structure. @param job Job structure. @param k Key (option name). @param v Option value. @param pk Primary key number from table (unused). @return Valid pointer to new object on success, NULL on error. */ itadmin_dhcp_option * itadmin_mem_dhcp_option_new( itadmin_job *job, char const *k, char const *v, long pk ); /** Destroy DHCP option structure, release memory. @param v Option to destroy. */ void itadmin_mem_dhcp_option_del(void *v); /** Read data from database. @param job Job structure. @return 1 on success, 0 on error. */ int itadmin_data_read(itadmin_job *job); /** Read data from MySQL database. @param job Job structure. @return 1 on success, 0 on error. */ int itadmin_data_mysql_read(itadmin_job *job); /** Register a user record. @param job Job structure. @param us_s User short name (login name). @param us_t User title or academic degree. @param us_sn Surname. @param us_fn Family name. @param us_em E-Mail. @param us_ko Cost control ID. @param us_se Organizational unit. @return 1 on success, 0 on error. */ int itadmin_register_user( itadmin_job *job, char const *us_s, char const *us_t, char const *us_sn, char const *us_fn, char const *us_em, char const *us_ko, char const *us_se ); /** Register building. @param job Job structure. @param gb_s Short building name. @param gb_l Long building name. @param gb_a1 Address line 1. @param gb_a2 Address line 2. @param gb_a3 Address line 3. @param gb_a4 Address line 4. @param gb_plz Zip code. @param gb_ort City name. @return 1 on success, 0 on error. */ int itadmin_register_building( itadmin_job *job, char const *gb_s, char const *gb_l, char const *gb_a1, char const *gb_a2, char const *gb_a3, char const *gb_a4, char const *gb_plz, char const *gb_ort ); /** Register a speed setting. @param job Job structure. @param sn Short name for setting. @param ln Description. @return 1 on success, 0 on error. */ int itadmin_register_speed( itadmin_job *job, char const *sn, char const *ln ); /** Register a VLAN. @param job Job structure. @param vl_s Short name for VLAN. @param vl_l Description. @return 1 on success, 0 on error. */ int itadmin_register_vlan(itadmin_job *job, char const *vl_s, char const *vl_l); /** Register patch (ethernet socket). @param job Job structure. @param dd_n Patch name. @param sp_s Speed setting name. @param vl_s VLAN short name. @param dd_p Hub port name. @param gb_s Building. @param dd_r Room number/name of patch. @return 1 on success, 0 on error. */ int itadmin_register_patch( itadmin_job *job, char const *dd_n, char const *sp_s, char const *vl_s, char const *dd_p, char const *gb_s, char const *dd_r ); /** Register network. @param job Job structure. @param nw_ip IP address. @param nw_ma Network mask. @param nw_gw Gateway. @param nw_bc Broadcast address. @param vl_s VLAN for network. @return 1 on success, 0 on error. */ int itadmin_register_network( itadmin_job *job, char const *nw_ip, char const *nw_ma, char const *nw_gw, char const *nw_bc, char const *vl_s ); /** Register DHCP pool. @param job Job structure. @param ips IP start address of pool. @param ipe IP end address of pool. @param nw Network address (may be NULL or empty). @param alu Flag: Allow unknown clients. @param dnu Flag: Deny unknown clients. @param dcn Allowed class name if unknown clients denied. @return 1 on success, 0 on error. */ int itadmin_register_dhcp_pool( itadmin_job *job, char const *ips, char const *ipe, char const *nw, int alu, int dnu, char const *dcn ); /** Register DHCP class. @param job Job structure. @param dcs Short class name. @param dcl Long class name (description). @return 1 on success, 0 on error. */ int itadmin_register_dhcp_class(itadmin_job *job,char const *dcs,char const *dcl); /** Register DHCP group. @param job Job structure. @param sn Short name. @param ln Long name (description). @return 1 on success, 0 on error. */ int itadmin_register_dhcp_group(itadmin_job *job, char const *sn, char const *ln); /** Register netgroup. @param job Job structure. @param ng_s Short netgroup name. @param ng_l Long name (description). @return 1 on success, 0 on error. */ int itadmin_register_netgroup(itadmin_job *job,char const *ng_s,char const *ng_l); /** Register netgroup dependency. @param job Job structure. @param pgn Name of the parent group. @param cgn Name of the child group. @return 1 on success, 0 on error. */ int itadmin_register_ngdep(itadmin_job *job, char const *pgn, char const *cgn); /** Register one host. @param job Job structure. @param co_s Short name for computer. @param us_s Owner / user in charge. @param co_ip IPv4 address. @param co_mc MAC address. @param ng_s Netgroup. @param co_co Comment for PC. @param dc_s DHCP class. @param dg_s DHCP group. @param dd_n Patch/connector number. @param gb_s Building. @param co_r Room number. @param co_in Inventory ID. @param co_sn Serial number. @param co_dd DNS domain name. @param co_ff Flag: Write FQDN first in /etc/hosts. @param co_gu Flag: BYOD (bring your own device). @param co_hi Host ID. @param co_ex Expiration date. @param co_nn Flag: Skip host in network documentation. @param co_na Flag: Skip host for arpwatch. */ int itadmin_register_host( itadmin_job *job, char const *co_s, char const *us_s, char const *co_ip, char const *co_mc, char const *ng_s, char const *co_co, char const *dc_s, char const *dg_s, char const *dd_n, char const *gb_s, char const *co_r, char const *co_in, char const *co_sn, char const *co_dd, int co_ff, int co_gu, char const *co_hi, itadmin_date *co_ex, int co_nn, int co_na ); /** Register host name alias. @param job Job structure. @param al Alias name. @param rn Real host name. @return 1 on success, 0 on error. */ int itadmin_register_alias(itadmin_job *job, char const *al, char const *rn); /** Register a DHCP option. @param job Job structure. @param sct Scope type name. @param scn Scope name. @param k Key (option name). @param v Option value. @param pk Primary key from database. @return 1 on success, 0 on error. */ int itadmin_register_dhcp_option( itadmin_job *job, char const *sct, char const *scn, char const *k, char const *v, long pk ); /** Check name for empty string or minus. We have to save the entry if the string pointer is not NULL and the string is not empty and not a minus. @param sn String to check. @return 1 if string must be saved, 0 for ignore. */ int itadmin_register_check_user_name(char const *sn); /** Check whether we can attempt to convert a string to an IP address. @param ip String to test. @return 1 for string with text, 0 for empty string. */ int itadmin_register_check_ip(char const *ip); /** Register a software manufacturer. @param job Job structure. @param sm_s Short name. @param sm_l Long name. @return 1 on success, 0 on error. */ int itadmin_register_swman( itadmin_job *job, char const *sm_s, char const *sm_l); /** Register a software product. @param job Job structure. @param sw_s Short software name. @param sw_l Long software name. @param sm_s Software manufacturer. @return 1 on success, 0 on error. */ int itadmin_register_swprod( itadmin_job *job, char const *sw_s, char const *sw_l, char const *sm_s ); /** Register a license type. @param job Job structure. @param lt_s Short license type name. @param lt_l Long name/description of license type. @param nl Number of licenses (for floating licenses). */ int itadmin_register_lictype( itadmin_job *job, char const *lt_s, char const *lt_l, int nl ); /** Register license. @param job Job structure. @param pk Primary key. @param li_on Order number (purchase process ID). @param sw_s Software short name. @param us_s User to which the license is assigned. @param co_s Computer on which the license is used. @param lt_s License type. @param li_no Optional note for the license. @param sr_s Software reseller. @param li_dd Delivery date. @param li_nd Delivery note number. @param li_di Invoide date. @param li_ni Invoice number. @return 1 on success, 0 on error. */ int itadmin_register_license( itadmin_job *job, unsigned long pk, char const *li_on, char const *sw_s, char const *us_s, char const *co_s, char const *lt_s, char const *li_no, char const *sr_s, itadmin_date *li_dd, char const *li_nd, itadmin_date *li_di, char const *li_ni ); /** Compare structures for user. @param l Left structure. @param r Right structure, object, or name. @param cr Comparison criteria (0=user/user by us, 1=user/name by us, 2=user/user by na+sn+tt+us). @return Comparison result. */ int itadmin_comp_user(void const *l, void const *r, int cr); /** Compare structures for buildings. @param l Left structure. @param r Right structure, object, or name. @param cr Comparison criteria (0=building/building by s, 1=building/name by s). @return Comparison result. */ int itadmin_comp_building(void const *l, void const *r, int cr); /** Compare structures for network speed. @param l Left structure. @param r Right structure, object, or name. @param cr Comparison criteria (0=speed/speed by s, 1=speed/name). @return Comparison result. */ int itadmin_comp_speed(void const *l, void const *r, int cr); /** Compare structures for VLAN. @param l Left structure. @param r Right structure, object, or name. @param cr Comparison criteria (0=vlan/vlan by s, 1=vlan/name by s). @return Comparison result. */ int itadmin_comp_vlan(void const *l, void const *r, int cr); /** Compare structures for ethernet socket. @param l Left structure. @param r Right structure, object, or name. @param cr Comparison criteria (0=socket/socket by s, 1=socket/name). @return Comparison result. */ int itadmin_comp_connect(void const *l, void const *r, int cr); /** Compare structures for network. @param l Left structure. @param r Right structure, object, or name. @param cr Comparison criteria (0=network/network by ip4, 1=network/ipaddress). @return Comparison result. */ int itadmin_comp_network(void const *l, void const *r, int cr); /** Compare structures for netgroup. @param l Left structure. @param r Right structure, object, or name. @param cr Comparison criteria (0=netgroup/netgroup by sn, 1=netgroup/name by sn). @return Comparison result. */ int itadmin_comp_netgroup(void const *l, void const *r, int cr); /** Compare structures for DHCP class. @param l Left structure. @param r Right structure, object, or name. @param cr Comparison criteria (0=class/class by sn, 1=class/name by sn). @return Comparison result. */ int itadmin_comp_dhcp_class(void const *l, void const *r, int cr); /** Compare structures for DHCP pool. @param l Left structure. @param r Right structure, object, or name. @param cr Comparison criteria (0=pool/pool by ip4s, 1=pool/ipaddress). @return Comparison result. */ int itadmin_comp_dhcp_pool(void const *l, void const *r, int cr); /** Compare structures for DHCP group. @param l Left structure. @param r Right structure, object, or name. @param cr Comparison criteria (0=group/group by sn, 1=group/name). @return Comparison result. */ int itadmin_comp_dhcp_group(void const *l, void const *r, int cr); /** Compare structures for host @param l Left structure. @param r Right structure, object, or name. @param cr Comparison criteria (0=host/host by sn, 1=host/name, 2=host/host by ipv4, 3=host/ipaddr). @return Comparison result. */ int itadmin_comp_host(void const *l, void const *r, int cr); /** Compare structures for software manufacturer. @param l Left structure. @param r Right structure, object, or name. @param cr Comparison criteria (0=swman/swman by sn, 1=swman/name). @return Comparison result. */ int itadmin_comp_swman(void const *l, void const *r, int cr); /** Compare structures for software product. @param l Left structure. @param r Right structure, object, or name. @param cr Comparison criteria (0=product/product by sn, 1=product/name, 2=product/product by mn->ln+ln). @return Comparison result. */ int itadmin_comp_swprod(void const *l, void const *r, int cr); /** Compare structures for license type. @param l Left structure. @param r Right structure, object, or name. @param cr Comparison criteria (0=type/type by sn, 1=type/name). @return Comparison result. */ int itadmin_comp_user(void const *l, void const *r, int cr); /** Compare structures for license type. @param l Left structure. @param r Right structure, object, or name. @param cr Comparison criteria (0=license/license by product). @return Comparison result. */ int itadmin_comp_lictype(void const *l, void const *r, int cr); /** Compare structures for license. @param l Left structure. @param r Right structure, object, or name. @param cr Comparison criteria (0=license/license by pk, 1=license/pk, 2=license/license by product). @return Comparison result. */ int itadmin_comp_license(void const *l, void const *r, int cr); /** Compare two licenses within a network. @param l Left object. @param r Right object or name. @param cr Comparison criteria (0=group/group, 1=group/name). @return Comparison result. */ int itadmin_comp_dhcp_ginw(void const *l, void const *r, int cr); /** Compare two date structures. @param l Left object. @param r Right object. @return 1 if @arg l is later than @arg r, 0 for equal days, 1 if @arg l is earlier than @arg r. */ int itadmin_comp_date(itadmin_date const *l, itadmin_date const *r); /** Compare two DHCP options. @param l Left object. @param r Right object. @param cr Comparison criteria (ignored). @return Comparison result. */ int itadmin_comp_dhcp_option(void const *l, void const *r, int cr); /** Compare two strings. @param l Left string. @param r Right string. @param cr Comparison criteria (1=case-insensitive, 0=normal). @return Comparison result. */ int itadmin_comp_string(void const *l, void const *r, int cr); /** Check whether we have to write network configuration and documentation. @param job Job structure. @return 1 for yes, 0 for no. */ int itadmin_job_do_network(itadmin_job *job); /** Check whether we have to write a dhcpd.conf file. @param job Job structure. @return 1 for yes, 0 for no. */ int itadmin_job_do_dhcp(itadmin_job *job); /** Check whether we have to write a license report. @param job Job structure. @return 1 for yes, 0 for no. */ int itadmin_job_do_licenses(itadmin_job *job); /** Convert string yyyy-mm-dd to date structure. @param job Job structure. @param dp Destination pointer. @param str Source text. @return 1 on success, 0 on error. */ int itadmin_tool_convert_date(itadmin_job *job, itadmin_date *dp, char const *str); /** Write IPv4 address to file. @param df Destination file. @param ipv4 Address to write. */ void itadmin_tool_write_ip(FILE *df, unsigned long ipv4); /** Write IPv4 address to stream. @param os Output stream. @param ipv4 Address to write. */ void itadmin_tool_stream_ip(dk3_stream_t *os, unsigned long ipv4); /** Write user name short to LaTeX output. @param job Job structure. @param os Output stream. @param user User to write. */ void itadmin_tool_write_user_latex_short( itadmin_job *job, dk3_stream_t *os, itadmin_user *user ); /** Write user name long to LaTeX output. @param job Job structure. @param os Output stream. @param user User to write. */ void itadmin_tool_write_user_latex_long( itadmin_job *job, dk3_stream_t *os, itadmin_user *user ); /** Write the section header in the table. @param job Job structure. @param os Output stream. @param kwi Keyword index. */ void itadmin_tool_table_section_header( itadmin_job *job, dk3_stream_t *os, size_t kwi ); /** Start a table line. @param job Job structure. @param os Output stream. @param kwi Keyword index in localized messages. */ void itadmin_tool_table_line_start( itadmin_job *job, dk3_stream_t *os, size_t kwi ); /** Separate two items in a table. @param job Job structure. @param os Output stream. */ void itadmin_tool_table_line_sep_rows( itadmin_job *job, dk3_stream_t *os ); /** Finish a table line. @param job Job structure. @param os Output stream. @param pb Flag: Allow page break here. */ void itadmin_tool_table_line_finish( itadmin_job *job, dk3_stream_t *os, int pb ); /** Create empty table field. @param job Job structure. @param os Output stream. @param nu Flag: Write notification for missing value. */ void itadmin_tool_table_line_no_data( itadmin_job *job, dk3_stream_t *os, int nu ); /** Write one detail table line. @param job Job structure. @param os Output stream. @param kwi Keyword index for option name. @param det Details to write. @param nu Flag: Write a note about unknown values. @param pb Flag: Allow page break after line. */ void itadmin_tool_table_line( itadmin_job *job, dk3_stream_t *os, size_t kwi, char const *det, int nu, int pb ); /** Write a table line consisting of two values. @param job Job structure. @param os Output stream. @param key Key. @param val Value. @param fb Flag: Key in bold. @param pb Flag: Allow page break. */ void itadmin_tool_table_values( itadmin_job *job, dk3_stream_t *os, char const *key, char const *val, int fb, int pb ); /** Check whether a host is owned by a user. @param us User. @param co Host. @return 1 if the host is owned by the user, 0 otherwise. */ int itadmin_tool_check_same_user(itadmin_user *us, itadmin_host *co); /** Write a section of text to output stream. @param job Job structure. @param os Output stream. @param sect Text section to write. */ void itadmin_tool_write_section( itadmin_job *job, dk3_stream_t *os, char const * const *sect ); /** Write log message of one part. @param job Job structure. @param ll Log level. @param i Index of message text in localized messages array. */ void itadmin_tool_log_1( itadmin_job *job, int ll, size_t i ); /** Write log message of three parts. @param job Job structure. @param ll Log level. @param i1 Index of first message text in localized messages array. @param i2 Index of third text part in localized messages array. @param msg Variable message text, second text part. */ void itadmin_tool_log_utf8_3( itadmin_job *job, int ll, size_t i1, size_t i2, char const *msg ); /** Write log message of five parts. @param job Job structure. @param ll Log level. @param i1 Index of first message text in localized messages array. @param i2 Index of third text part in localized messages array. @param i3 Index of fifth text part in localized messages array. @param msg1 First variable message text, second text part. @param msg2 Second variable messagetext, fourth text part. */ void itadmin_tool_log_utf8_5( itadmin_job *job, int ll, size_t i1, size_t i2, size_t i3, char const *msg1, char const *msg2 ); /** Write log message of three parts. @param job Job structure. @param ll Log level. @param i1 Index of first constant message part. @param i2 Index of third message part. @param pk Primary key as numeric value. */ void itadmin_tool_log_pk_3( itadmin_job *job, int ll, size_t i1, size_t i2, unsigned long pk ); /** Write log message of five parts. @param job Job structure. @param ll Log level. @param i1 Index of first constant message part. @param i2 Index of third message part. @param i3 Index of fifth message part. @param pk Primary key as numeric value. @param msg Variable message part. */ void itadmin_tool_log_pk_5( itadmin_job *job, int ll, size_t i1, size_t i2, size_t i3, unsigned long pk, char const *msg ); /** Write IPv4 address to buffer. @param bu Destination buffer, at least 16 bytes long. @param ip IP address. */ void itadmin_tool_ip_to_buffer(char *bu, unsigned long ip); /** Write hosts file. @param job Job structure. @return 1 on success, 0 on error. */ int itadmin_hosts_output(itadmin_job *job); /** Write hosts.ldif file. @param job Job structure. @return 1 on success, 0 on error. */ int itadmin_hosts_ldif_output(itadmin_job *job); /** Write ethers-by-ip and ethers-by-mac files. @param job Job structure. @return 1 on success, 0 on error. */ int itadmin_ethers_output(itadmin_job *job); /** Write ethers.ldif file. @param job Job structure. @return 1 on success, 0 on error. */ int itadmin_ethers_ldif_output(itadmin_job *job); /** Expand netgroup dependencies. @param job Job structure. @return 1 on success, 0 on error. */ int itadmin_netgroup_expand(itadmin_job *job); /** Check whether a host is a member of a netgroup. @param job Job structure. @param netgroup Netgroup. @param host Host. @return 0 for no member, 1 for indirect member, 2 for direct member. */ int itadmin_netgroup_host_member( itadmin_job *job, itadmin_netgroup *netgroup, itadmin_host *host ); /** Write netgroup.ldif file. @param job Job structure. @return 1 on success, 0 on error. */ int itadmin_netgroup_ldif_output(itadmin_job *job); /** Write dhcpd.conf file. @param job Job structure. @return 1 on success, 0 on error. */ int itadmin_dhcpd_conf_output(itadmin_job *job); /** Write network documentation file. @param job Job structure. @return 1 on success, 0 on error. */ int itadmin_netdocu(itadmin_job *job); /** Write license report. @param job Job structure. @return 1 on success, 0 on error. */ int itadmin_license_report(itadmin_job *job); #ifdef __cplusplus } #endif %% module #include "dk3all.h" #include "itadmin.h" #if 0 #include "dkt-version.h" #endif #include "dk4vers.h" $!trace-include /** Keywords used by the program, not localized. */ static dkChar const * const itadmin_kw_noloc[] = { $!string-table macro=dkT # # 0: Program group name. # dktools # # 1: String table name. # itadmin.str # # 2: Program name used in version # itadmin # # 3: Help text file name. # itadmin.txt # # 4: Configuration file name. # itadmin.conf $!end }; /** Localized message texts. */ static dkChar const * const itadmin_kw[] = { $!string-table macro=dkT # # 0: Title for network documentation # Network documentation # # 1: Subject for network documentation # Network documentation # # 2: LaTeX packages for localization # # # 3: Hosts # Hosts # # 4: Other hosts # Other hosts # # 5: Overview # Overview # # 6: Purpose: # Purpose: # # 7: Inventory ID: # Inventory ID: # # 8: Serial no: # Serial no: # # 9: not specified (unknown) # not specified # # 10: Main user: (person responsible for host) # Main user: # # 11: Place (building and room) # Place: # # 12: Network # Network # # 13: IP address # IP address: # # 14: DNS domain # DNS domain: # # 15: MAC address # MAC address: # # 16: Ethernet socket (patch no) # Ethernet socket: # # 17: DHCP class # DHCP class: # # 18: DHCP group # DHCP group: # # 19: Netgroups # Netgroups # # 20: Notice, this is an address from a DHCP pool # IP address from DHCP pool, dynamically assigned to DHCP clients # # 21: Short section header BYOD + DHCP # BYOD DHCP # # 22: Section header BYOD + DHCP # Bring your own device, use DHCP # # 23: # This is a ``bring your own device'' system, not owned by our organizational # # 24: # unit. # # 25: # This host is not owned by our organizational unit, it is a computer outside. # # 26: # It is listed in configuration files and documentation because there is a # # 27: # need for communication between our computers and this system. # # 28: # IP address dynamically assigned to computers. # # 29: Parent groups # Parent groups # # 30: Subgroups # Subgroups # # 31: Additional network interface # Additional network interface. # # 32: Member hosts for netgroups # Member hosts # # 33: DHCP pools # DHCP pools # # 34: Start address # Start address: # # 35: End address # End address: # # 36: Allow unknown clients # Allow unknown clients: # # 37: Deny unknown clients # Deny unknown clients: # # 38: Allow members of group # Allow class: # # 39: yes # yes # # 40: no # no # # 41: DHCP classes # DHCP classes # # 42: Ethernet connectors # Ethernet connectors # # 43: Connector # Connector # # 44: Room # Room # # 45: VLAN # VLAN # # 46: Speed # Speed # # 47: Hub port # Hub port # # 48: Available licenses # Available licenses # # 49/50: Message to explain section contents # The licenses listed here were purchased by the organizational unit but not (yet) assigned to a user or computer. # # 51: LaTeX text for pdftitle # License report # # 52: LaTeX text for pdfsubject # licenses # # 53: Default license type: Single computer license # Single computer license # # 54: LaTeX text: Purchase process ID # Purchase process ID: # # 55: LaTeX text: Delivery date # Delivery date: # # 56: LaTeX text: Delivery note ID (Lieferschein-Nr) # Delivery note ID: # # 57: LaTeX text: Invoice date # Invoice date: # # 58: LaTeX text: Invoice ID (Rechnungs-Nr) # Invoice ID: # # 59: LaTeX text: Complete license list # Complete license list # # 60: LaTeX text: Host unknown # Host unknown # # 61: LaTeX text: Assignment to host not specified. # Assignment to host not specified # # 62: LaTeX text: Other people's hosts # Other people's hosts # # 63: LaTeX text: Licenses used on other people's hosts # Licenses used on other people's hosts # # 64: LaTeX text # The licenses listed in this section were assigned to the user. # # 65: LaTeX text # There is no information available (yet) on which computers the licenses # # 66: LaTeX text # are used. # # 67: LaTeX text # The licenses listed in this section were assigned to the user. # # 68: LaTeX text # At this time they are used on computers other people are # # 69: LaTeX text # responsible for. # # 70: LaTeX text # Note: # # 71: LaTeX text # These licenses are listed twice in the license report: # # 72: LaTeX text # Once in the section for the host and once again here. # # 73: LaTeX text # This special situation is indicated in the host licenses section by # # 74: LaTeX text # the license owner name written in an # # 75: LaTeX text # italic font. # # 76: String separator in date, - for english, . for german # - # # 77: Progress message: Expanding netgroup dependencies. # Expanding netgroup dependencies. # # 78: Progress message: Writing hosts file. # Writing "hosts" file. # # 79: Progress message: Writing hosts.ldif file. # Writing "hosts.ldif" file. # # 80: Progress message: Writing ethers files. # Writing "ethers" files. # # 81: Progress message: Writing ethers.ldif file. # Writing "ethers.ldif" file. # # 82: Progress message: Writing netgroup.ldif file. # Writing "netgroup.ldif" file. # # 83: Progress message: Writing dhcpd.conf file. # Writing "dhcpd.conf" file. # # 84: Progress message: Writing netdocu.tex file. # Writing "netdocu.tex" file. # # 85: Progress message: Writing licenses.tex file. # Writing "licenses.tex" file. # # 86: Progress message: Finished writing output files. # Finished writing output files. # # 87: Progress message: Reading users table. # Reading users table. # # 88: Progress message: Reading buildings table. # Reading buildings table. # # 89: Progress message: Reading network speed types table. # Reading network speed types table. # # 90: Progress message: Reading VLANs table. # Reading VLANs table. # # 91: Progress message: Reading ethernet connectors table. # Reading ethernet connectors table. # # 92: Progress message: Reading netgroups table. # Reading netgroups table. # # 93: Progress message: Reading netgroup dependencies table. # Reading netgroup dependencies table. # # 94: Progress message: Reading networks table. # Reading networks table. # # 95: Progress message: Reading DHCP classes table. # Reading DHCP classes table. # # 96: Progress message: Reading DHCP groups table. # Reading DHCP groups table. # # 97: Progress message: Reading DHCP pools table. # Reading DHCP pools table. # # 98: Progress message: Reading hosts table. # Reading hosts table. # # 99: Progress message: Reading host name aliases table. # Reading host name aliases table. # # 100: Progress message: Reading DHCP options table. # Reading DHCP options table. # # 101: Progress message: Reading software manufacturers table. # Reading software manufacturers table. # # 102: Progress message: Reading software products table. # Reading software products table. # # 103: Progress message: Reading license types table. # Reading license types table. # # 104: Progress message: Reading licenses table. # Reading licenses table. # # 105: Progress message: Finished reading input from database. # Finished reading input from database. # # 106/107: ERROR: Not a boolean value "..."! # Not a boolean value: " "! # # 108/109: ERROR: Configuration text "..." too long! # Configuration value text " " too long! # # 110/111: ERROR: No such database type: "..."! # No such database type: " "! # # 112: ERROR: A value text is required! # A value text is required! # # 113/114: ERROR: Unknown configuration option "..."! # Unknown configuration option " "! # # 115: ERROR: Syntax error - "=" and value required! # Syntax error - "=" and value required! # # 116: ERROR: Input line too long! # Input line too long! # # 117: ERROR: Missing end of section name! # Missing end of section name! # # 118/119: ERROR: File name contains wildcards, this is not allowed! # File name " "\ncontains wildcards, this is not allowed! # # 120/121: WARNING: File name "..." is not an absolute path name! # File name " "\nis not an absolute path name! # # 122: ERROR: Missing database host name! # Missing database host name! # # 123: ERROR: Missing database name! # Missing database name! # # 124: WARNING: Missing DHCP VLAN name! # Missing DHCP VLAN name! # # 125: ERROR: Missing organization name! # Missing organization name! # # 126: ERROR: Missing organizational unit name! # Missing organizational unit name! # # 127: ERROR: Missing administrator name! # Missing administrator name! # # 128: ERROR: Missing database credentials file name! # Missing database credentials file name! # # 129: ERROR: Missing database user name! # Missing database user name! # # 130: ERROR: Missing database user password! # Missing database user password! # # 131: ERROR: No configuration files found! # No configuration file(s) "itadmin.conf" found!# # # 132: ERROR: Configuration problems! # Configuration problems,\nplease check the itadmin.conf configuration files! # # 133: ERROR: Unsupported database type! # Unsupported database type! # # 134: ERROR start: DHCP pool " # DHCP pool " # # 135: ERROR: # ": Inconsistent setup!\nUnknown clients can be allowed or denied to use a pool, not both! # # 136: ERROR start DHCP class " # DHCP class " # # 137: ERROR: DHCP class assigned to pools in different networks! # " assigned to pools in different networks! # # 138: ERROR: DHCP pool "...": Missing allowed DHCP class name! # ": Missing allowed DHCP class name! # # 139/140: ERROR: No such VLAN! # No such VLAN: " "! # # 141: ERROR: Failed to obtain results list! # Failed to obtain results list for database query! # # 142: ERROR: Failed to query database! # Failed to query database! # # 143: ERROR: Primary key is not numeric! # Table "licenses", record # # 144: ERROR: Primary key is not numeric! # Primary key is not numeric! # # 145: ERROR: Missing primary key! # Missing primary key! # # 146, 147, 148: License type "...": Not a number "..."! # License type " ": Not a number " "! # # 149/150: ERROR: Tabel swm record ... Missing primary key! # Table "swmanufacturers" record Missing primary key! # # 151: ERROR start: Table "dhcpoptions" record ... # Table "dhcpoptions" record # # 152: ERROR: Primary key is not numeric! # Primary key is not numeric! # # 153: ERROR: Missing primary key! # Missing primary key! # # 154: ERROR: Failed to set database encoding! # Failed to set database encoding! # # 155/156/157: ERROR: Failed to connect to database! # Failed to connect to database " " at host " "! # # 158/159: ERROR: Illegal database name! # Illegal database name: " "! # # 160: ERROR: Failed to convert database user password! # Failed to convert database user passwort to UTF-8! # # 161/162: ERROR: Failed to convert database user name to UTF-8! # Failed to convert database user name " " to UTF-8! # # 163/164: ERROR: Failed to convert database host name to UTF-8! # Failed to convert database host name " " to UTF-8! # # 165: ERROR: Failed to initialize MySQL client object! # Failed to initialize MySQL client object! # # 166: ERROR: Failed to initialize MySQL client library! # Failed to initialize MySQL client library! # # 167: ERROR: MySQL database support not available! # MySQL database support not available! # # 168/169: ERROR: User name "...": Duplicated entry! # User name " ": Duplicated entry! # # 170/171: ERROR: Building "...": Duplicated entry! # Building " ": Duplicated entry! # # 172/173: ERROR: Ethernet speed setting "...": Duplicated entry! # Ethernet speed setting " ": Duplicated entry! # # 174/175: VLAN "...": Duplicated entry! # VLAN " ": Duplicated entry! # # 176/177: Computer "...": Duplicated entry! # Computer " ": Duplicated entry! # # 178/179: Software manufacturer "...": Duplicated entry! # Software manufacturer " ": Duplicated entry! # # 180/181: Netgroup "...": Duplicated entry! # Netgroup " ": Duplicated entry! # # 182/183: Netgroup "..." not defined! # Netgroup " " not defined! # # 184/185: Ethernet connector "...": Duplicated entry! # Ethernet connector " ": Duplicated entry! # # 186/187: Ethernet speed setting "..." not defined! # Ethernet speed setting " " not defined! # # 188/189: VLAN "..." not defined! # VLAN " " not defined! # # 190/191: Building "..." not defined! # Building " " not defined! # # 192/193: Failed to convert net mask "..."! # Failed to convert net mask " "! # # 194: Using default net mask 255.255.255.0! # Using default net mask 255.255.255.0! # # 195/196: Failed to convert default gateway "..."! # Failed to convert default gateway " "! # # 197/198: Using default gateway ... # Using default gateway . # # 199/200: Failed to convert broadcast address! # Failed to convert broadcast address " "! # # 201/202: Network "...": Duplicated entry! # Network " ": Duplicated entry! # # 203: Attempt to define IP network without specifying an IP address! # Attempt to define IP network without specifying an IP address! # # 204/205: DHCP class "...": Duplicated entry! # DHCP class " ": Duplicated entry! # # 206/207: DHCP group "...": Duplicated entry! # DHCP group " ": Duplicated entry! # # 208/209: Invalied network address "..."! # Invalid network address " "! # # 210/211: DHCP class "..." not defined! # DHCP class " " not defined! # # 212/213: Network "..." not defined! # Network " " not defined! # # 214/215: DHCP pool "...": Invalid end address! # DHCP pool " ": Invalid end address! # # 216/217: DHCP pool "...": Missing end address! # DHCP pool " ": Missing end address! # # 218/219: DHCP pool "...": Invalid start address! # DHCP pool " ": Invalid start address! # # 220: DHCP pool definition attempted with empty start address! # DHCP pool definition attempted with empty start address! # # 221/222: Computer "...": Illegal MAC address! # Computer " ": Illegal MAC address! # # 223/224: Computer "...": MAC address too long! # Computer " ": MAC address too long! # # 225/226/227: Computer "...": User "..." not defined! # Computer " ": User " " not defined! # # 228/229/230: Computer "...": Netgroup "..." not defined! # Computer " ": Netgroup " " not defined! # # 231/232/233: Computer "...": DHCP class "..." not defined! # Computer " ": DHCP class " " not defined! # # 234/235/236: Computer "...": DHCP group "..." not defined! # Computer " ": DHCP group " " not defined! # # 237/238/239: Computer "...": Ethernet connector "..." not defined! # Computer " ": Ethernet connector " " not defined! # # 240/241/242: Computer "...": Building "..." not defined! # Computer " ": Building " " not defined! # # 243/244: Computer "...": Both DHCP class and IP address defined! # Computer " ": Both DHCP class and IP address specified! # # 245/246: Computer "...": DHCP class specified, but MAC address missing! # Computer " ": DHCP class specified, but MAC address is missing! # # 247/248: Computer "...": Netgroup specified, but IP address missing! # Computer " ": Netgroup specified, but IP address is missing! # # 249/250: Computer "...": Netgroup specified, but DNS domain missing! # Computer " ": Netgroup specified, but DNS domain is missing! # # 251/252: Computer "...": FQDN first flag set, but DNS domain missing! # Computer " ": FQDN first flag set, but DNS domain is missing! # # 253/254: Computer "...": Over expiration date, should be removed! # Computer " ": Over expiration date, should be removed! # # 255: Attempt to define a computer without a host name! # Attempt to define a computer without a host name! # # 256/257/258: Alias "...": Computer "..." not defined! # Alias " ": Computer " " not defined! # # 259/260/261: DHCP option ...: VLAN "..." not defined! # DHCP option : VLAN " " not defined! # # 262/263/264: DHCP option ...: Network "..." not defined! # DHCP option : Network " " not defined! # # 265/266/267: DHCP option ...: DHCP group "..." not defined! # DHCP option : DHCP group " " not defined! # # 268/269/270: DHCP option ...: DHCP pool "..." not defined! # DHCP option : DHCP pool " " not defined! # # 271/272/273: DHCP option ...: Computer "..." not defined! # DHCP option : Computer " " not defined! # # 274/275/276: DHCP option ...: Unknown scope type name "..."! # DHCP option : Unknown scope type name " "! # # 277/278: Software product "...": Duplicated entry! # Software product " ": Duplicated entry! # # 279/280/281: Software product "...": Manufacturer "..." not defined! # Software product " ": Software manufacturer " " not defined! # # 282/283: License type "...": Duplicated entry! # License type " ": Duplicated entry! # # 284/285: License ...: Duplicated entry! # License : Duplicated entry! # # 286/287/288: License ...: User "..." not defined! # License : User " " not defined! # # 289/290/291: License ...: Computer "..." not defined! # License : Computer " " not defined! # # 292/293/294: License ...: License type "..." not defined! # License : License type " " not defined! # # 295/296/297: License ... assigned to computer "..." but no user specified! # License assigned to computer " " but no user specified! # # 298/299: License ...: No software product specified! # License : No software product specified! # # 300/301: Illegal date specification "..."! # Illegal date specification " "! # # 302: Koma-script suggestion. # Users from Europe - especially from Germany - should consider using koma-script. # # 303/304: ERROR: Illegal software manufacturer! # Illegal software manufacturer (short name): " "! # # 305/306: ERROR: Illegal software! # Illegal software (short name): " "! # # 307/308: ERROR: Illegal license type! # Illegal license type (short name): " "! # # 309: ERROR: Failed to reset sensitive memory range! # Failed to reset sensitive memory range! $!end }; /** License text written for --license option. */ static dkChar const * const itadmin_license_overview[] = { $!text macro=dkT Overview ======== This software uses code from the following projects, either directly or by linking a library: dktools DK tools and libraries See http://dktools.sourceforge.net for information. MySQL MySQL client library. See http://www.mysql.com for information. $!end }; /** License for the dktools project. */ static dkChar const * const itadmin_license_dktools[] = { $!text macro=dkT License conditions for DK tools and libraries ============================================= Copyright (c) 2012-2016, Dirk Krause All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder(s) nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. $!end }; /** License for the MySQL client library (GPL + FLOSS exception). */ static dkChar const * const itadmin_license_mysql[] = { $!text macro=dkT License conditions for the MySQL client library =============================================== GNU General Public License -------------------------- GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. MySQL FLOSS License Exception ----------------------------- MySQL FLOSS License Exception The MySQL AB Exception for Free/Libre and Open Source Software-only Applications Using MySQL Client Libraries (the "FLOSS Exception"). Version 0.6, 7 March 2007 Exception Intent We want specified Free/Libre and Open Source Software (``FLOSS'') applications to be able to use specified GPL-licensed MySQL client libraries (the ``Program'') despite the fact that not all FLOSS licenses are compatible with version 2 of the GNU General Public License (the ``GPL''). Legal Terms and Conditions As a special exception to the terms and conditions of version 2.0 of the GPL: 1. You are free to distribute a Derivative Work that is formed entirely from the Program and one or more works (each, a "FLOSS Work") licensed under one or more of the licenses listed below in section 1, as long as: a. You obey the GPL in all respects for the Program and the Derivative Work, except for identifiable sections of the Derivative Work which are not derived from the Program, and which can reasonably be considered independent and separate works in themselves, b. all identifiable sections of the Derivative Work which are not derived from the Program, and which can reasonably be considered independent and separate works in themselves, i. are distributed subject to one of the FLOSS licenses listed below, and ii. the object code or executable form of those sections are accompanied by the complete corresponding machine-readable source code for those sections on the same medium and under the same FLOSS license as the corresponding object code or executable forms of those sections, and c. any works which are aggregated with the Program or with a Derivative Work on a volume of a storage or distribution medium in accordance with the GPL, can reasonably be considered independent and separate works in themselves which are not derivatives of either the Program, a Derivative Work or a FLOSS Work. If the above conditions are not met, then the Program may only be copied, modified, distributed or used under the terms and conditions of the GPL or another valid licensing option from MySQL AB. 2. FLOSS License List License name Version(s)/Copyright Date Academic Free License 2.0 Apache Software License 1.0/1.1/2.0 Apple Public Source License 2.0 Artistic license From Perl 5.8.0 BSD license "July 22 1999" Common Development and Distribution License (CDDL) 1.0 Common Public License 1.0 Eclipse Public License 1.0 GNU Library or "Lesser" General Public License (LGPL) 2.0/2.1 Jabber Open Source License 1.0 MIT license (As listed in file MIT-License.txt) --- Mozilla Public License (MPL) 1.0/1.1 Open Software License 2.0 OpenSSL license (with original SSLeay license) "2003" ("1998") PHP License 3.0 Python license (CNRI Python License) --- Python Software Foundation License 2.1.1 Sleepycat License "1999" University of Illinois/NCSA Open Source License --- W3C License "2001" X11 License "2001" Zlib/libpng License --- Zope Public License 2.0 Due to the many variants of some of the above licenses, we require that any version follow the 2003 version of the Free Software Foundation's Free Software Definition (http://www.gnu.org/philosophy/free-sw.html) or version 1.9 of the Open Source Definition by the Open Source Initiative (http://www.opensource.org/docs/definition.php). 3. Definitions a. Terms used, but not defined, herein shall have the meaning provided in the GPL. b. Derivative Work means a derivative work under copyright law. 4. Applicability: This FLOSS Exception applies to all Programs that contain a notice placed by MySQL AB saying that the Program may be distributed under the terms of this FLOSS Exception. If you create or distribute a work which is a Derivative Work of both the Program and any other work licensed under the GPL, then this FLOSS Exception is not available for that work; thus, you must remove the FLOSS Exception notice from that work and comply with the GPL in all respects, including by retaining all GPL notices. You may choose to redistribute a copy of the Program exclusively under the terms of the GPL by removing the FLOSS Exception notice from that copy of the Program, provided that the copy has never been modified by you or any third party. Appendix A. Qualified Libraries and Packages The following is a non-exhaustive list of libraries and packages which are covered by the FLOSS License Exception. Please note that this appendix is provided merely as an additional service to specific FLOSS projects wishing to simplify licensing information for their users. Compliance with one of the licenses noted under the "FLOSS license list" section remains a prerequisite. Package Name Qualifying License and Version Apache Portable Runtime (APR) Apache Software License 2.0 $!end }; /** Help text shown for --help. */ static dkChar const * const itadmin_help_text[] = { $!text macro=dkT NAME itadmin - IT administration using databases SYNOPSIS itadmin [] [] DESCRIPTION The program reads IT-related information from a database and creates configuration files, a network documentation, and a license report. A configuration file can be specified as argument, the program searches for itadmin.conf files if no configuration file is specified. OPTIONS -c --configuration Create configuration files and network documentation. -l --licenses Create license report. If none of -c and -l is used the program creates all output (same as both -c and -l used). -h --help Show a help text. -v --version Show version information. -L --license-terms Show license terms. EXIT STATUS 0 on success, all other exit status codes indicate an error. FILES itadmin.conf The itadmin.conf file contains the configuration information used by the program. The file consists of key=value pairs, one per line. Keys can consist of multiple words. Lines started by '#' are comments. The following key=value pairs can be used: database host = database name = database credentials file = dhcpd.conf vlan = organization = organizational unit = administrator name = AUTHOR Dirk Krause HISTORY The itadmin program replaces the hostsadm script found in previous versions of dktools. COPYRIGHT AND LICENSE Run itadmin --license-terms to see the license conditions. SEE ALSO http://dktools.sourceforge.net $!end }; /** Options for the itadmin program. */ static dk3_option_t const itadmin_options[] = { { dkT('h'), dkT("help"), 0 }, { dkT('v'), dkT("version"), 0 }, { dkT('L'), dkT("license-terms"), 0 }, { dkT('c'), dkT("configuration"), 0 }, { dkT('l'), dkT("licenses"), 0 }, }; /** Number of elements in itadmin_options. */ static size_t itadmin_sz_options = (sizeof(itadmin_options)/sizeof(dk3_option_t)); int itadmin_job_do_network(itadmin_job *job) { int back = 0; if(job) { if((job->cmd) & ITADMIN_CMD_CONFIG) { back = 1; } } return back; } int itadmin_job_do_dhcp(itadmin_job *job) { int back = 0; if(itadmin_job_do_network(job)) { if(job->f_dh) { back = 1; } } return back; } int itadmin_job_do_licenses(itadmin_job *job) { int back = 0; if(job) { if((job->cmd) & ITADMIN_CMD_LICENSES) { back = 1; } } return back; } /** Clean up a storage, destroy contained objects. @param s Storage to clean up. @param i Iterator through storage. @param f Function to use on each object. */ static void itadmin_clean_storage( dk3_sto_t **s, dk3_sto_it_t **i, itadmin_obj_del *f ) { void *v; if(*s) { if(*i) { dk3sto_it_reset(*i); while((v = dk3sto_it_next(*i)) != NULL) { (*f)(v); } dk3sto_it_close(*i); } dk3sto_close(*s); } *s = NULL; *i = NULL; } /** Initialize job structure. @param job Job structure to initialize. @param app Application structure for diagnostics. @param msg Localized message texts. @param noloc Texts, not localized. */ static void itadmin_job_init( itadmin_job *job, dk3_app_t *app, dkChar const * const *msg, dkChar const * const *noloc ) { job->app = app; job->opt = NULL; job->msg = msg; job->noloc = noloc; job->exval = 1; job->cmd = 0; job->ec = 0; job->f_dh = 0; job->dbt = DK3_SQLDB_TYPE_MYSQL; job->dbhn = NULL; job->uc2l = NULL; job->dbn = NULL; job->dbcf = NULL; job->dbus = NULL; job->dbpw = NULL; job->vlan = NULL; job->org = NULL; job->ou = NULL; job->admn = NULL; job->ldapb = NULL; job->ngdep = NULL; job->nng = 0; job->s_us = NULL; job->i_us = NULL; job->s_usn = NULL; job->i_usn = NULL; job->s_bu = NULL; job->i_bu = NULL; job->s_sp = NULL; job->i_sp = NULL; job->s_vl = NULL; job->i_vl = NULL; job->s_pa = NULL; job->i_pa = NULL; job->s_nw = NULL; job->i_nw = NULL; job->s_ng = NULL; job->i_ng = NULL; job->s_nd = NULL; job->i_nd = NULL; job->s_dc = NULL; job->i_dc = NULL; job->s_dp = NULL; job->i_dp = NULL; job->s_dg = NULL; job->i_dg = NULL; job->s_ho = NULL; job->i_ho = NULL; job->s_hoi = NULL; job->i_hoi = NULL; job->s_sm = NULL; job->i_sm = NULL; job->s_sw = NULL; job->i_sw = NULL; job->s_lt = NULL; job->i_lt = NULL; job->s_lc = NULL; job->i_lc = NULL; job->s_lf = NULL; job->i_lf = NULL; job->s_do = NULL; job->i_do = NULL; job->dbptr = NULL; job->gdate = 0; job->hlh = 0; job->ukoma = 0; job->rel = 0; if(*(msg[76]) == dkT('.')) { job->gdate = 1; } } /** Prepare a storage/iterator pair. @param job Job structure. @param s Address of storage pointer. @param i Address if iterator pointer. @param f Object comparison function for storage. @param cr Comparison criteria. @param ok Pointer to OK flag, reset on errors. */ static void itadmin_job_prepare_storage( itadmin_job *job, dk3_sto_t **s, dk3_sto_it_t **i, dk3_fct_comp_t *f, int cr, int *ok ) { *s = NULL; *i = NULL; *s = dk3sto_open_app(job->app); if(*s) { *i = dk3sto_it_open(*s); if(*i) { if(f) { dk3sto_set_comp(*s, f, cr); } } else { *ok = 0; } } else { *ok = 0; } } /** Prepare all data structures for a job. @param job Job structure. @return 1 on success, 0 on error. */ static int itadmin_job_up(itadmin_job *job) { dk3_time_t ct; dk3_tm_t tm; int back = 1; int f_utf8 = 0; (job->today).y = 0; (job->today).m = 0; (job->today).d = 0; if(dk3sf_time(&ct)) { if(dk3sf_localtime_app(&tm, &ct, job->app)) { (job->today).y = tm.Y; (job->today).m = tm.M; (job->today).d = tm.D; } } itadmin_job_prepare_storage( job, &(job->s_us), &(job->i_us), itadmin_comp_user, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_usn), &(job->i_usn), itadmin_comp_user, 2, &back ); itadmin_job_prepare_storage( job, &(job->s_bu), &(job->i_bu), itadmin_comp_building, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_sp), &(job->i_sp), itadmin_comp_speed, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_vl), &(job->i_vl), itadmin_comp_vlan, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_pa), &(job->i_pa), itadmin_comp_connect, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_nw), &(job->i_nw), itadmin_comp_network, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_ng), &(job->i_ng), itadmin_comp_netgroup, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_nd), &(job->i_nd), NULL, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_dc), &(job->i_dc), itadmin_comp_dhcp_class, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_dp), &(job->i_dp), itadmin_comp_dhcp_pool, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_dg), &(job->i_dg), itadmin_comp_dhcp_group, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_ho), &(job->i_ho), itadmin_comp_host, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_hoi), &(job->i_hoi), itadmin_comp_host, 2, &back ); itadmin_job_prepare_storage( job, &(job->s_sm), &(job->i_sm), itadmin_comp_swman, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_sw), &(job->i_sw), itadmin_comp_swprod, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_lt), &(job->i_lt), itadmin_comp_lictype, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_lc), &(job->i_lc), itadmin_comp_license, 0, &back ); itadmin_job_prepare_storage( job, &(job->s_lf), &(job->i_lf), itadmin_comp_license, 2, &back ); itadmin_job_prepare_storage( job, &(job->s_do), &(job->i_do), itadmin_comp_dhcp_option, 0, &back ); f_utf8 = 0; if(DK3_ENCODING_UTF8 == dk3app_get_encoding(job->app)) { f_utf8 = 1; } job->uc2l = dk3uc2lat_open_app(NULL, 0, f_utf8, job->app); if(!(job->uc2l)) { back = 0; } return back; } /** Clean up job structure. @param job Job structure to clean up. */ static void itadmin_job_cleanup(itadmin_job *job) { #if 0 /* 2016-12-09 Function dk3mem_reset_secure() to sanitize memory was added. */ size_t sz; size_t i; int ok = 1; #endif if(job->opt) { dk3opt_close(job->opt); } job->opt = NULL; if(job->uc2l) { dk3uc2lat_close(job->uc2l); } job->uc2l = NULL; $!trace-code if(job->dbhn) { $!trace-code dk3sf_fputs(dkT("DB hostname: "), stdout); $!trace-code dk3sf_fputs(job->dbhn, stdout); $!trace-code dk3sf_fputc(dkT('\n'), stdout); $!trace-code } dk3_release(job->dbhn); $!trace-code if(job->dbn) { $!trace-code dk3sf_fputs(dkT("DB name: "), stdout); $!trace-code dk3sf_fputs(job->dbn, stdout); $!trace-code dk3sf_fputc(dkT('\n'), stdout); $!trace-code } dk3_release(job->dbn); $!trace-code if(job->dbcf) { $!trace-code dk3sf_fputs(dkT("DB credfile: "), stdout); $!trace-code dk3sf_fputs(job->dbcf, stdout); $!trace-code dk3sf_fputc(dkT('\n'), stdout); $!trace-code } dk3_release(job->dbcf); $!trace-code if(job->dbus) { $!trace-code dk3sf_fputs(dkT("DB username: "), stdout); $!trace-code dk3sf_fputs(job->dbus, stdout); $!trace-code dk3sf_fputc(dkT('\n'), stdout); $!trace-code } if(job->dbus) { #if 0 /* 2016-12-09 Function dk3mem_reset_secure() to sanitize memory was added. */ dk3mem_res((void *)(job->dbus), dk3str_c8_len(job->dbus)); #endif (void)dk3mem_reset_secure((void *)(job->dbus), dk3str_c8_len(job->dbus)); } dk3_release(job->dbus); $!trace-code if(job->dbpw) { #if 0 $!trace-code dk3sf_fputs(dkT("DB password: "), stdout); $!trace-code dk3sf_fputs(job->dbpw, stdout); $!trace-code dk3sf_fputc(dkT('\n'), stdout); #endif $!trace-code } if(job->dbpw) { #if 0 /* 2016-12-09 Function dk3mem_reset_secure() to sanitize memory was added. */ sz = dk3str_c8_len(job->dbpw); dk3mem_res((void *)(job->dbpw), dk3str_c8_len(job->dbpw)); /* Static code analysis: Dead assignment ok = 0 */ /* The purpose of the following instruction is to avoid */ /* optimizing out the memory reset in the instruction before. */ for (i = 0; i < sz; i++) { if('\0' != (job->dbpw)[i]) { ok = 0; } } if (1 != ok) { dk3app_log_1(job->app, DK3_LL_ERROR, job->msg, 309); } #endif (void)dk3mem_reset_secure((void *)(job->dbpw), dk3str_c8_len(job->dbpw)); } dk3_release(job->dbpw); $!trace-code if(job->vlan) { $!trace-code dk3sf_fputs(dkT("VLAN name: "), stdout); $!trace-code dk3sf_fputs(job->vlan, stdout); $!trace-code dk3sf_fputc(dkT('\n'), stdout); $!trace-code } dk3_release(job->vlan); $!trace-code if(job->org) { $!trace-code dk3sf_fputs(dkT("Organization: "), stdout); $!trace-code dk3sf_fputs(job->org, stdout); $!trace-code dk3sf_fputc(dkT('\n'), stdout); $!trace-code } dk3_release(job->org); $!trace-code if(job->ou) { $!trace-code dk3sf_fputs(dkT("OU name: "), stdout); $!trace-code dk3sf_fputs(job->ou, stdout); $!trace-code dk3sf_fputc(dkT('\n'), stdout); $!trace-code } dk3_release(job->ou); $!trace-code if(job->admn) { $!trace-code dk3sf_fputs(dkT("admin name: "), stdout); $!trace-code dk3sf_fputs(job->admn, stdout); $!trace-code dk3sf_fputc(dkT('\n'), stdout); $!trace-code } dk3_release(job->admn); $!trace-code if(job->ldapb) { $!trace-code dk3sf_fputs(dkT("ldap base: "), stdout); $!trace-code dk3sf_fputs(job->ldapb, stdout); $!trace-code dk3sf_fputc(dkT('\n'), stdout); $!trace-code } dk3_release(job->ldapb); itadmin_clean_storage(&(job->s_us), &(job->i_us), itadmin_mem_user_del); itadmin_clean_storage(&(job->s_bu), &(job->i_bu), itadmin_mem_building_del); itadmin_clean_storage(&(job->s_sp), &(job->i_sp), itadmin_mem_speed_del); itadmin_clean_storage(&(job->s_vl), &(job->i_vl), itadmin_mem_vlan_del); itadmin_clean_storage(&(job->s_pa), &(job->i_pa), itadmin_mem_connect_del); itadmin_clean_storage(&(job->s_nw), &(job->i_nw), itadmin_mem_network_del); itadmin_clean_storage(&(job->s_ng), &(job->i_ng), itadmin_mem_netgroup_del); itadmin_clean_storage(&(job->s_nd), &(job->i_nd), itadmin_mem_ngdep_del); itadmin_clean_storage(&(job->s_dc), &(job->i_dc), itadmin_mem_dhcp_class_del); itadmin_clean_storage(&(job->s_dp), &(job->i_dp), itadmin_mem_dhcp_pool_del); itadmin_clean_storage(&(job->s_dg), &(job->i_dg), itadmin_mem_dhcp_group_del); if(job->s_hoi) { if(job->i_hoi) { dk3sto_it_close(job->i_hoi); } dk3sto_close(job->s_hoi); } job->s_hoi = NULL; job->i_hoi = NULL; if(job->s_usn) { if(job->i_usn) { dk3sto_it_close(job->i_usn); } dk3sto_close(job->s_usn); } job->s_usn = NULL; job->i_usn = NULL; itadmin_clean_storage(&(job->s_ho), &(job->i_ho), itadmin_mem_host_del); itadmin_clean_storage(&(job->s_sm), &(job->i_sm), itadmin_mem_sw_man_del); itadmin_clean_storage(&(job->s_sw), &(job->i_sw), itadmin_mem_software_del); itadmin_clean_storage(&(job->s_lt), &(job->i_lt), itadmin_mem_lic_type_del); if(job->s_lf) { if(job->i_lf) { dk3sto_it_close(job->i_lf); } dk3sto_close(job->s_lf); } job->s_lf = NULL; job->i_lf = NULL; itadmin_clean_storage(&(job->s_lc), &(job->i_lc), itadmin_mem_license_del); itadmin_clean_storage(&(job->s_do),&(job->i_do),itadmin_mem_dhcp_option_del); if(job->ngdep) { dk3bm_close(job->ngdep); job->ngdep = NULL; } } /** Process command line arguments. @param job Job structure. @return 1 on success (can continue), 0 on error. */ static int itadmin_process_arguments(itadmin_job *job) { dkChar const * const *xargv = NULL; int xargc = 0; int back = 0; $? "+ itadmin_process_arguments" xargc = dk3app_get_argc(job->app); xargv = dk3app_get_argv(job->app); xargv++; xargc--; job->opt = dk3opt_open_app( itadmin_options, itadmin_sz_options, dkT('\0'), NULL, xargc, xargv, job->app ); if(job->opt) { if(0 == dk3opt_get_error_code(job->opt)) { back = 1; if(dk3opt_is_set(job->opt, dkT('c'))) { job->cmd |= ITADMIN_CMD_CONFIG; } if(dk3opt_is_set(job->opt, dkT('l'))) { job->cmd |= ITADMIN_CMD_LICENSES; } if(dk3opt_is_set(job->opt, dkT('h'))) { job->cmd |= ITADMIN_CMD_HELP; } if(dk3opt_is_set(job->opt, dkT('v'))) { job->cmd |= ITADMIN_CMD_VERSION; } if(dk3opt_is_set(job->opt, dkT('L'))) { job->cmd |= ITADMIN_CMD_LICENSE_TERMS; } } else { $? "! errors in opt proc" } } else { $? "! failed to read opts" } $? "- itadmin_process_arguments %d", back return back; } /** Show version number. @param job Job structure. */ static void itadmin_show_version(itadmin_job *job) { dk3sf_fputs(itadmin_kw_noloc[2], stdout); dk3sf_fputs(DKT_VERSION_DK, stdout); dk3sf_fputc(dkT('\n'), stdout); #if !(DK3_HAVE_MYSQL_MYSQL_H || DK3_HAVE_MYSQL_H) dk3app_log_1(job->app, DK3_LL_ERROR, job->msg, 167); #endif } /** Show help text. @param job Job structure. */ static void itadmin_show_help(itadmin_job *job) { dk3app_help(job->app, itadmin_kw_noloc[3], itadmin_help_text); } /** Show one text section, used to show license terms. @param job Job structure. @param ltxt License text to show. */ static void itadmin_show_license_section(itadmin_job *job, dkChar const * const *ltxt) { dkChar const * const *sptr; sptr = ltxt; while(*sptr) { dk3sf_fputs(*(sptr++), stdout); dk3sf_fputc(dkT('\n'), stdout); } } /** Show license conditions. @param job Job structure. */ static void itadmin_show_license(itadmin_job *job) { itadmin_show_license_section(job, itadmin_license_overview); itadmin_show_license_section(job, itadmin_license_dktools); itadmin_show_license_section(job, itadmin_license_mysql); } /** Run the tasks. @param job Job structure. */ static void itadmin_run(itadmin_job *job) { int success = 0; if(itadmin_config_read(job)) { if(itadmin_data_read(job)) { /* PROGRESS: Expanding netgroup dependencies. */ itadmin_tool_log_1(job, DK3_LL_PROGRESS, 77); if(itadmin_netgroup_expand(job)) { success = 1; if(itadmin_job_do_network(job)) { /* Hosts */ /* PROGRESS: Writing hosts file. */ itadmin_tool_log_1(job, DK3_LL_PROGRESS, 78); if(!itadmin_hosts_output(job)) { $? "! hosts output" success = 0; } if(job->ldapb) { /* PROGRESS: Writing hosts.ldif file. */ itadmin_tool_log_1(job, DK3_LL_PROGRESS, 79); if(!itadmin_hosts_ldif_output(job)) { $? "! hosts.ldif output" success = 0; } } /* Ethers */ /* PROGRESS: Writing ethers file. */ itadmin_tool_log_1(job, DK3_LL_PROGRESS, 80); if(!itadmin_ethers_output(job)) { $? "! ethers output" success = 0; } if(job->ldapb) { /* PROGRESS: Writing ethers.ldif file. */ itadmin_tool_log_1(job, DK3_LL_PROGRESS, 81); if(!itadmin_ethers_ldif_output(job)) { $? "! ethers ldif" success = 0; } } /* Netgroups */ /* PROGRESS: Writing netgroup.ldif file. */ itadmin_tool_log_1(job, DK3_LL_PROGRESS, 82); if(!itadmin_netgroup_ldif_output(job)) { $? "! netgroup.ldif" success = 0; } /* DHCP configuration */ if(itadmin_job_do_dhcp(job)) { /* PROGRESS: Writing dhcpd.conf file. */ itadmin_tool_log_1(job, DK3_LL_PROGRESS, 83); if(!itadmin_dhcpd_conf_output(job)) { $? "! dhcpd.conf" success = 0; } } /* Network documentation */ /* PROGRESS: Writing netdocu.tex file. */ itadmin_tool_log_1(job, DK3_LL_PROGRESS, 84); if(!itadmin_netdocu(job)) { $? "! netdocu output" success = 0; } } if(itadmin_job_do_licenses(job)) { /* Write license report. */ /* PROGRESS: Writing licenses.tex file. */ itadmin_tool_log_1(job, DK3_LL_PROGRESS, 85); if(!itadmin_license_report(job)) { $? "! license report" success = 0; } } } /* PROGRESS: Finished writing output. */ itadmin_tool_log_1(job, DK3_LL_PROGRESS, 86); } } if(success) { job->exval = 0; } else { $? "! no success" } } /** Run program or print help/license/version. @param job Job structure. */ static void itadmin_run_or_help(itadmin_job *job) { $? "+ itadmin_run_or_help" if((job->cmd) & (~(ITADMIN_CMD_CONFIG | ITADMIN_CMD_LICENSES))) { $? ". help" job->exval = 0; dk3sf_initialize_stdout(); if((job->cmd) & ITADMIN_CMD_VERSION) { $? ". version" itadmin_show_version(job); } if((job->cmd) & ITADMIN_CMD_LICENSE_TERMS) { $? ". license" itadmin_show_license(job); } if((job->cmd) & ITADMIN_CMD_HELP) { $? ". help" itadmin_show_help(job); } } else { $? ". run" if(!((job->cmd) & (ITADMIN_CMD_CONFIG | ITADMIN_CMD_LICENSES))) { job->cmd = (ITADMIN_CMD_CONFIG | ITADMIN_CMD_LICENSES); } itadmin_run(job); } $? "- itadmin_run_or_help" } /** Entry point of the program. @param argc Number of command line arguments. @param argv Command line arguments array. @return 0 on success, any other value indicates an error. */ DK3_MAIN { itadmin_job job; /* Job structure. */ dk3_app_t *app; /* Application structure. */ dkChar const * const *msg; /* Localized message texts. */ int exval = 1; /* Exit status code. */ $!trace-init itadmin.deb $? "+ main" #if DK3_HAVE_TZSET tzset(); #endif job.exval = 1; app = dk3app_open_command( argc, (dkChar const * const *)argv, itadmin_kw_noloc[0] ); if(app) { msg = dk3app_messages(app,itadmin_kw_noloc[1],(dkChar const **)itadmin_kw); if(msg) { itadmin_job_init(&job, app, msg, itadmin_kw_noloc); if(itadmin_job_up(&job)) { if(itadmin_process_arguments(&job)) { itadmin_run_or_help(&job); } } itadmin_job_cleanup(&job); } else { /* BUG: Should not happen as dk3app_messages() returns the default string array if there is any error. */ } dk3app_close(app); } else { /* ERROR: Memory */ fprintf( stderr, "ERROR: Not enough memory\n" ); fflush(stderr); } exval = job.exval; $? "- main %d", exval $!trace-end fflush(stdout); exit(exval); return exval; }