Dear All,

When I am compiling my test gssapi code I get the following below errors

hykerbtcsso:~ # ./testgss1.c
-bash: ./testgss1.c: Permission denied
hykerbtcsso:~ # gcc testgss1.c
/tmp/ccOaZHE4.o(.text+0x24): In function `server_acquire_creds':
: undefined reference to `GSS_C_NT_HOSTBASED_SERVICE'
/tmp/ccOaZHE4.o(.text+0x31): In function `server_acquire_creds':
: undefined reference to `gss_import_name'
/tmp/ccOaZHE4.o(.text+0x5f): In function `server_acquire_creds':
: undefined reference to `gss_acquire_cred'
/tmp/ccOaZHE4.o(.text+0x84): In function `server_acquire_creds':
: undefined reference to `gss_release_name'
collect2: ld returned 1 exit status

Any help would be greatly appreciated.


This is my test code:

1 #include
2 #include
3 #include
4 #include
5
6 int server_acquire_creds(service_name, server_creds)
7 char *service_name;
8 gss_cred_id_t *server_creds;
9 {
10 gss_buffer_desc name_buf;
11 gss_name_t server_name;
12 OM_uint32 maj_stat, min_stat;
13
14 name_buf.value = service_name;
15 name_buf.length = strlen(name_buf.value) + 1;
16 maj_stat = gss_import_name(&min_stat, &name_buf,
17 (gss_OID) GSS_C_NT_HOSTBASED_SERVICE, &server_name);
18 if (maj_stat != GSS_S_COMPLETE) {
19 /* display_status("importing name", maj_stat, min_stat);
*/
20 return -1;
21 }
22
23 maj_stat = gss_acquire_cred(&min_stat, server_name, 0,
24 GSS_C_NULL_OID_SET,
GSS_C_ACCEPT,
25 server_creds, NULL, NULL);
26 if (maj_stat != GSS_S_COMPLETE) {
27 /* display_status("acquiring credentials", maj_stat,
min_stat); */
28 return -1;
29 }
30
31 (void) gss_release_name(&min_stat, &server_name);
32
33 return 0;
34 }
35
36 int main(argc, argv)
37
38 int argc;
39 char **argv;
40 {
41 char *service_name;
42 gss_cred_id_t creds;
43 OM_uint32 min_stat;
44 u_short port =4444;
45 service_name = *argv;
46 int result = server_acquire_creds(service_name, &creds);
47 printf("%d\n", result);
48
49 return 0;
50
51 }