Additional Data for Security Information

From InterBase
Jump to: navigation, search

Go Up to Querying Security Configuration


The isc_info_svc_get_users result item returns multiple sets of data. There might be multiple users to report, so the result buffer might contain multiple clusters. The contents of the buffer end when a cluster is identified with the isc_info_flag_end value. The following table describes the cluster identifiers for the user information.

Services API user information arguments
Argument Purpose Return length Return value

isc_spb_username

The user ID from the InterBase security database (admin.ib by default)

2 bytes + string

String

isc_spb_firstname

The first name associated with the user ID

2 bytes + string

String

isc_spb_middlename

The middle name associated with the user ID

2 bytes + string

String

isc_spb_lastname

The last name associated with the user ID

2 bytes + string

String

isc_spb_userid

The user ID number, defined in /etc/passwd, to assign to the user; relevant only on UNIX or Linux servers

4 bytes

Unsigned long

isc_spb_groupid

The group ID number, defined in /etc/group, to assign to the user; relevant only on UNIX or Linux servers

4 bytes

Unsigned long

isc_info_flag_end

Signals the end of arguments to isc_info_svc_get_users

Querying using Services API: users configured on the server

. . .
case isc_info_svc_get_users: {
ISC_USHORT len, loop;
ISC_ULONG id;
char buffer[50], *buf = buffer;

loop = (ISC_USHORT)
isc_portable_integer (p, sizeof (ISC_USHORT));
p += sizeof (ISC_USHORT);

while (*p != isc_info_end) {
switch (*p++) {
case isc_spb_sec_username:
len = (ISC_USHORT)
isc_portable_integer(p, sizeof(ISC_USHORT));
p += sizeof (ISC_USHORT);
strncpy (buf, p, len);
p += len;
buffer[len] = 0;
printf ("Username: %s\n", buffer);
loop -= (len + sizeof(ISC_USHORT)+1);
break;

case isc_spb_sec_firstname:
len = (ISC_USHORT)
isc_portable_integer(p, sizeof(ISC_USHORT));
p += sizeof (ISC_USHORT);
strncpy (buf, p, len);
p += len;
buffer[len] = 0;
printf ("Firstname: %s\n", buffer);
loop -= (len + sizeof(ISC_USHORT)+1);
break;

case isc_spb_sec_middlename:
len = (ISC_USHORT)
isc_portable_integer(p, sizeof(ISC_USHORT));
p += sizeof (ISC_USHORT);
strncpy (buf, p, len);
p += len;
buffer[len] = 0;
printf ("Middlename: %s\n", buffer);
loop -= (len + sizeof(ISC_USHORT)+1);
break;

case isc_spb_sec_lastname:
len = (ISC_USHORT)
isc_portable_integer(p, sizeof(ISC_USHORT));
p += sizeof (ISC_USHORT);
strncpy (buf, p, len);
p += len;
buffer[len] = 0;
printf ("Lastname: %s\n", buffer);
loop -= (len + sizeof(ISC_USHORT)+1);
break;

case isc_spb_sec_groupid:
id = isc_portable_integer (p, sizeof (ISC_ULONG));
p += sizeof (ISC_ULONG);
printf ("Group ID: %d\n", id);
loop -= (len + sizeof(ISC_ULONG)+1);
break;

case isc_spb_sec_userid:
id = isc_portable_integer (p, sizeof (ISC_ULONG));
p += sizeof (ISC_ULONG);
printf ("User ID: %d\n", id);
loop -= (len + sizeof(ISC_ULONG)+1);
break;

default:
*x = *p;
break;
} /* end switch */
} /* end while */
break;
}
. . .

The isc_info_svc_svr_db_info result item returns multiple sets of data. There might be multiple active databases to report, so the result buffer might contain multiple clusters. The contents of the buffer end when a cluster is identified with the isc_info_flag_end value. The following table describes the cluster identifiers for the database connection information.

Services API database connection information arguments
Argument Purpose Return length Return value

isc_spb_num_att

The number of attachments currently in use on the server

4 bytes

Unsigned long

isc_spb_num_db

The number of databases currently in use on the server

4 bytes

Unsigned long

isc_spb_dbname

The name of one of the databases currently in use on the server; this item occurs once for each database in use

2 bytes + string

String

isc_info_flag_end

Signals the end of arguments to isc_info_svc_svr_db_info

Querying using Services API: database attachments

. . .
case isc_info_svc_svr_db_info: {
printf ("Database information:\n");
do {
switch (*p++) {
case isc_spb_dbname: {
/* Database names in use */
path_length = (unsigned short)
isc_portable_integer(p, sizeof(unsigned short));
p += sizeof (unsigned short);
buffer = (char*) malloc (path_length);
strncpy (buffer, p, path_length);
buffer [path_length] = '\0';
printf ("Database in use: %s\n", buffer);
p += path_length;
break;
}
case isc_spb_num_att: {
/* Num Attachments */
unsigned long nAttachments;
p+= sizeof (unsigned short);
nAttachments = (unsigned long)
isc_portable_integer(p, sizeof (unsigned long));
printf ("\tNumber of attachments: %d\n",
nAttachments);
p += sizeof(unsigned long);
break;
}
case isc_spb_num_db: {
/* Num databases */
unsigned long nDatabases;
p+= sizeof (unsigned short);
nDatabases = (unsigned long)
isc_portable_integer(p, sizeof(unsigned long));
printf ("\tNumber of databases: %d\n",
nDatabases);
p += sizeof(unsigned long);
break;
}
}
} while (*p != isc_info_flag_end);
break;
}
. . .

Querying using Services API: end of example

. . .
}
} while (*p);

isc_service_detach(status, &service_handle);
}

Advance To: