GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
login.c File Reference
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <grass/gis.h>
#include <grass/dbmi.h>
#include <grass/glocale.h>
Include dependency graph for login.c:

Go to the source code of this file.

Data Structures

struct  DATA
 
struct  LOGIN
 

Functions

void init_login (LOGIN *login)
 
void add_login (LOGIN *login, const char *dr, const char *db, const char *usr, const char *pwd)
 
int read_file (LOGIN *login)
 
int write_file (LOGIN *login)
 
int db_set_login (const char *driver, const char *database, const char *user, const char *password)
 Set user/password for driver/database. More...
 
int db_get_login (const char *driver, const char *database, const char **user, const char **password)
 Get user/password for driver/database if driver/database is not found, user/password are set to NULL. More...
 

Function Documentation

void add_login ( LOGIN login,
const char *  dr,
const char *  db,
const char *  usr,
const char *  pwd 
)

Definition at line 45 of file login.c.

References LOGIN::a, LOGIN::data, DATA::database, DATA::driver, G_store(), LOGIN::n, DATA::password, and DATA::user.

Referenced by db_set_login(), and read_file().

int db_get_login ( const char *  driver,
const char *  database,
const char **  user,
const char **  password 
)

Get user/password for driver/database if driver/database is not found, user/password are set to NULL.

Returns
DB_OK
DB_FAILED

Definition at line 204 of file login.c.

References LOGIN::data, DATA::database, DATA::driver, G_debug(), G_store(), init_login(), LOGIN::n, NULL, DATA::password, read_file(), and DATA::user.

int db_set_login ( const char *  driver,
const char *  database,
const char *  user,
const char *  password 
)

Set user/password for driver/database.

Returns
DB_OK
DB_FAILED

Definition at line 155 of file login.c.

References add_login(), LOGIN::data, DATA::database, DATA::driver, G_debug(), G_store(), init_login(), LOGIN::n, DATA::password, read_file(), DATA::user, and write_file().

void init_login ( LOGIN login)

Definition at line 36 of file login.c.

References LOGIN::a, LOGIN::data, malloc(), and LOGIN::n.

Referenced by db_get_login(), and db_set_login().

int read_file ( LOGIN login)

Definition at line 66 of file login.c.

References add_login(), buf, fclose(), fd, file, G_chop(), G_debug(), G_getl2(), G_warning(), LOGIN::n, NULL, and stat.

Referenced by db_get_login(), and db_set_login().

int write_file ( LOGIN login)

Definition at line 115 of file login.c.

References LOGIN::data, DATA::database, DATA::driver, fclose(), fd, file, G_debug(), LOGIN::n, NULL, DATA::password, and DATA::user.

Referenced by db_set_login().