grant a user access to a specific EELS databases
cc [flag ...] file ...
-kthread-leels [library] ...
int dbAddDbPriv( char *host,
unsigned int privs);
grants a user privileges to a specific database.
Privileges set using this routine will override the
global privileges set using
When an application connects to a database using
the username is sent to the database server for
authentication. In the case of mySQL this is the login
user name. If a user logs into a machine and uses
to log in as another user, the username that the user used
to login is sent to the database server. This should be kept
in mind when diagnosing problems with database privileges.
A user can be granted a number of privileges to EELS
databases. Privileges are passed to this routine in the form of
a bitmask. The bitmask is made up by OR'ing together one or
more of the privilege bits defined in the table below.
User privilege bitmask values
Allow records to be read from a database
Allow records to be written to a database
Allow records to be modified in a database.
Allow records to be deleted from a database
Allow tables to be created in a database
Allow tables to be dropped from a database
If a user is going to be given privileges to add and
delete tables from a database (that is, DB_CREATE_PRIV
and DB_DROP_PRIV), then the user also needs to be
granted access to the EELS administrative database.
This can be done by using dbAddDbPriv to grant the
user access to the EELS_Admin database. For example,
to grant user ``foo'' access to the EELS_Admin
database call dbAddDbPriv as follows:
This enables user ``foo'' to select, insert, and
delete records from the EELS_Admin databases.
This is necessary because routines such as
modify the EELS_Admin database.
(Input) IP/Hostname from which the user is
connecting to the database
(Input) The name of the user that is being
granted database privileges.
(Input) The name of the database to which the
user will be granted privileges.
(Input) Bitmask defining privileges granted to
dbAddUserPriv returns 0 if successful.
Otherwise, it returns -1.