+Thu Jul 25 02:16:56 1996 Theodore Y. Ts'o <tytso@mit.edu>
+
+ * gss.c (parse_name): Add code to parse an optional fourth
+ parameter which is the mechanism OID to actually use. If
+ it is ommited, the default mechanism is used.
+
+ * gss-client.c (client_establish_context): Added parameter
+ oid_name, which allows the user to specify the OID that
+ he/she actually wants to use to as the mechanism.
+
Wed Jun 12 00:16:46 1996 Theodore Ts'o <tytso@rsts-11.mit.edu>
* gss-clie.c: Renamed to gss-client.c, for VFAT/NTFS filesystems
const gss_OID_desc * gss_nt_service_name = oids+3;
int
-gss (char *host, char *name, char *msg, int port)
+gss (char *host, char *name, char *oid, char *msg, int port)
{
if (port == 0 || port == -1)
port = 4444;
- if (call_server(host, port, name, msg) < 0)
+ if (call_server(host, port, name, oid, msg) < 0)
return 1;
return 0;
* otherwise 0 is returned.
*/
int
-call_server (char *host, u_short port, char *service_name, char *msg)
+call_server (char *host, u_short port, char *service_name, char *oid, char *msg)
{
gss_ctx_id_t context;
gss_buffer_desc in_buf, out_buf;
return -1;
/* Establish context */
- if (client_establish_context(s, service_name, &context) < 0)
+ if (client_establish_context(s, service_name, oid, &context) < 0)
return -1;
/* Seal the message */
* and -1 is returned.
*/
int
-client_establish_context (int s, char *sname, gss_ctx_id_t *gss_context)
+client_establish_context (int s, char *sname, char *oid_name,
+ gss_ctx_id_t *gss_context)
{
gss_buffer_desc send_tok, recv_tok, *token_ptr;
gss_name_t target_name;
OM_uint32 maj_stat, min_stat;
+ gss_OID oid = GSS_C_NULL_OID;
+
+ if (oid_name && oid_name[0]) {
+ send_tok.value = oid_name;
+ send_tok.length = strlen(oid_name);
+ maj_stat = gss_str_to_oid(&min_stat, &send_tok, &oid);
+ if (maj_stat != GSS_S_COMPLETE) {
+ display_status("str_to_oid", maj_stat, min_stat);
+ return -1;
+ }
+ }
/*
- * Import the name into target_name. Use send_tok to save
- * local variable space.
- */
+ * Import the name into target_name. Use send_tok to save
+ * local variable space.
+ */
send_tok.value = sname;
send_tok.length = strlen(sname) + 1;
maj_stat = gss_import_name(&min_stat, &send_tok,
GSS_C_NO_CREDENTIAL,
gss_context,
target_name,
- GSS_C_NULL_OID,
+ oid,
GSS_C_MUTUAL_FLAG | GSS_C_REPLAY_FLAG,
0,
NULL, /* no channel bindings */
#define MAX_HOSTS 9
char hosts[MAX_HOSTS][256];
-char szHost[256]; // GSSAPI Host to connect to
-char szServiceName[256]; // Service to do
-int port = 0; // Which port to use
+char szHost[256]; // GSSAPI Host to connect to
+char szServiceName[256]; // Service to do
+char szOID[256]; // OID to use
+int port = 0; // Which port to use
static void do_gssapi_test (char *name);
static void parse_name (char *name);
parse_name(name); // Get host, service and port
hcursor = SetCursor(LoadCursor(NULL, IDC_WAIT));
- n = gss (szHost, szServiceName, "Test Gssapi Message", port);
+ n = gss (szHost, szServiceName, szOID, "Test Gssapi Message", port);
SetCursor(hcursor);
if (n)
}else{
wsprintf (szServiceName, "sample@%s", szHost); // Make the service name
}
+ if( ptr ){
+ ptr = strtok( NULL, seps);
+ }
+ if( ptr ){
+ wsprintf (szOID, "{ %s }", ptr); // Put in the OID
+ for (ptr = szOID; *ptr; ptr++)
+ if (*ptr == '.')
+ *ptr = ' ';
+ } else {
+ szOID[0] = 0;
+ }
+
}
/*+*************************************************************************
**
void my_perror (char *msg);
// gss-client.c
-int gss (char *host, char *name, char *msg, int port);
-int call_server(char *host, u_short port, char *service_name, char *msg);
+int gss (char *host, char *name, char *msg, char *oid, int port);
+int call_server(char *host, u_short port, char *service_name, char *oid, char *msg);
int connect_to_server(char *host, u_short port);
-int client_establish_context(int s, char *service_name, gss_ctx_id_t *gss_context);
+int client_establish_context(int s, char *service_name, char *oid, gss_ctx_id_t *gss_context);