Next Previous Contents

5. The /etc/conf.linuxconf database

5.1 Introduction

#Specification: /etc/conf.linuxconf / format ([confdb.cc,102])

/etc/conf.linuxconf is an ascii file. It contain all the information used to configured most services which lack a standard configuration file. Its format is simple

        keyword value ...
The file is maintained by linuxconf. No comments or whatever are allowed. This mecanism is handled by the CONFDB object. It is expect to be used for other stuff than /etc/conf.linuxconf.

#Specification: /etc/conf.linuxconf / format / subsystem ([confdb.cc,119])

This file is broken into subsystem. A subsystem is identified by a line like this

        [subsys]
Every entries below this line belong to this subsystem until another subsystem definition is reached or the end of the file. The file generally does not start with a subsystem definition. Entry at the beginning of the file belongs to the main subsystem (noname).

#Specification: linuxconf / /etc/conf.linuxconf / keys ([confdb.cc,298])

The keyword of /etc/conf.linuxconf use a special format convention. With a dot notation, the keyword is splitted in two part: The first identify the system and the second represent one parameter of this system. This strategy prevent clashes between two systems.

5.2 Extracting values

linuxconf_getval()

Locate one configuration parameter. Return NULL if not found.

        const char *linuxconf_getval(
                const char *prefix,
                const char *key)
        

linuxconf_getval()

Locate one configuration parameter. Return defval if not found.

        const char *linuxconf_getval(
                const char *prefix,
                const char *key,
                const char *defval)
        

linuxconf_getvalnum()

Locate one numeric configuration parameter. Return defval if not found.

        int linuxconf_getvalnum(
                const char *prefix,
                const char *key,
                int defval)
        

linuxconf_getall()

Locate all configuration parameter with the same key. Return the number found.

        int linuxconf_getall(
                const char *prefix,
                const char *key,
                SSTRINGS&lst,
                bool copy)      // Take a copy of the values
        

5.3 Updating /etc/conf.linuxconf

linuxconf_removeall()

Remove all entry with a given key.

        void linuxconf_removeall(
                const char *prefix,
                const char *key)
        

linuxconf_forget()

Forget the in memory copy of /etc/conf.linuxconf

        void linuxconf_forget(
                void)
        

linuxconf_save()

Save the configuration parameters Return -1 if any error.

        int linuxconf_save(
                PRIVILEGE *priv)
        

linuxconf_save()

Save the configuration parameters Return -1 if any error.

        int linuxconf_save(
                void)
        

linuxconf_add()

Add one record to the configuration file

        void linuxconf_add(
                const char *prefix,
                const char *key,
                const char *val)
        

linuxconf_add()

Add one record in the configuration file

        void linuxconf_add(
                const char *prefix,
                const char *key,
                const SSTRING&val)
        

linuxconf_add()

Add one record in the configuration file

        void linuxconf_add(
                const char *prefix,
                const char *key,
                int val)
        

linuxconf_replace()

Replace one record in the configuration file

        void linuxconf_replace(
                const char *prefix,
                const char *key,
                const char *val)
        

linuxconf_replace()

Replace one record in the configuration file

        void linuxconf_replace(
                const char *prefix,
                const char *key,
                char val)
        

linuxconf_replace()

Replace one record in the configuration file

        void linuxconf_replace(
                const char *prefix,
                const char *key,
                int val)
        

linuxconf_replace()

Replace one record in the configuration file

        void linuxconf_replace(
                const char *prefix,
                const char *key,
                bool val)
        

linuxconf_replace()

Replace one record in the configuration file

        void linuxconf_replace(
                const char *prefix,
                const char *key,
                long val)
        

linuxconf_replace()

Replace one record in the configuration file

        void linuxconf_replace(
                const char *prefix,
                const char *key,
                const SSTRING&val)
        

linuxconf_replace()

Replace all records to the configuration file for a key

        void linuxconf_replace(
                const char *prefix,
                const char *key,
                const SSTRINGS&vals)
        

5.4 Misc

linuxconf_getdistdir()

Get the directory name used to differentiate distribution specific stuff in linuxconf

        const char *linuxconf_getdistdir(
                void)
        

linuxconf_fixdistdir()

Fix a path which contain the /DIST/ subdir with the

        void linuxconf_fixdistdir(
                const char *templat,
                char *path)
        

linuxconf_reloadif()

Reload /etc/conf.linuxconf if the copy on disk is different from our in memory copy. Return != 0 if the file was reloaded

        int linuxconf_reloadif(
                void)
        

linuxconf_getdb()

Get a pointer to the main linuxconf's configuration database

        CONFDB *linuxconf_getdb(
                void)
        

5.5 Some specs

#Specification: /etc/conf.linuxconf / can't be moved ([configf.cc,512])

Given that /etc/conf.linuxconf is used to store almost everything which do not have a standard home (configuration file), including the the corrected path of the configuration themselves it is not possible to change the location of /etc/conf.linuxconf.

#Specification: /etc/conf.linuxconf / permissions ([linuxconf.cc,17])

For security reasons, /etc/conf.linuxconf is unreadable for all users except root. There is a lot of information in it allowing potential intruders to spot information that they really don't need to know. For exemple, /etc/conf.linuxconf tells which users have which administrative privilege. This is not much for an intruder, but it certainly tells which user passwords have move value than others.

#Specification: /etc/conf.linuxconf / spreaded in distributions ([linuxconf.cc,69])

The file /etc/conf.linuxconf does contain various stuff which is normally stored in various distribution specific (proprietary) files and format. The function linuxconf_sethook() lets a module insert a filter object in the handling of the /etc/conf.linuxconf files. This filter object may intercept request to this file and dispatch those to the proper cnnfig files. The function pointer provided will be called with a CONFDB object handling the current /etc/conf.linuxconf (there is one conf.linuxconf per administration tree when using the netadm module). It return another CONFDB object which does whatever it wants. This CONFDB object is probably derived from CONFDB and insert all kind of filtering. The function called has the responsability to delete CONFDB object passed as an argument when it is not needed anymore.


Next Previous Contents