* Perform Remote Kerberos Administrative Functions
*/
+#include <unistd.h>
#include <stdio.h>
#include <ctype.h>
#include <sys/types.h>
krb5_init_context(&context);
krb5_init_ets(context);
- client_name = (char *) malloc(755);
- memset((char *) client_name, 0, sizeof(client_name));
-
while ((option = getopt(argc, argv, "c:np:")) != EOF) {
switch (option) {
case 'c':
if (optind < argc) {
/* Admin name specified on command line */
+ client_name = (char *) malloc(755);
+ memset((char *) client_name, 0, sizeof(client_name));
strcpy(client_name, argv[optind++]);
if (retval = krb5_parse_name(context, client_name, &client)) {
fprintf(stderr, "Error Parsing %s\n", client_name);
/* At this point, both client and client_name are set up. */
if (!nflag) {
+ free(client_name);
+ client_name = (char *) malloc(755);
strcpy(client_name, client->data[0].data);
strncat(client_name, "/admin@", 7);
strncat(client_name, client->realm.data, client->realm.length);
+ krb5_free_principal(context, client);
if (retval = krb5_parse_name(context, client_name, &client)) {
fprintf(stderr, "Unable to Parse %s\n", client_name);
usage();
exit(1);
}
free(inbuf.data);
+ free(msg_data.data);
valid = 0;
princ_name[0] = '\0';
if (rd_priv_resp.message)
free(rd_priv_resp.message);
+ krb5_free_principal(context, client);
exit(retval);
}
}
if ((retval = krb5_os_localaddr(&my_addresses))) {
+ free(client_name);
fprintf(stderr, "Unable to Get Principals Address!\n");
return(1);
}
fprintf(stderr, "Error %s while building client name!\n",
error_message(retval));
krb5_free_addresses(context, my_addresses);
+ free(client_name);
return(1);
}
if ((password = (char *) calloc (1, 255)) == NULL) {
fprintf(stderr, "No Memory for Retrieving Admin Password!\n");
+ free(client_name);
return(1);
}
client_name);
free(password);
krb5_free_addresses(context, my_addresses);
+ free(client_name);
return(1);
}
memset((char *) password, 0, pwsize);
free(password);
krb5_free_addresses(context, my_addresses);
+ free(client_name);
if (retval) {
fprintf(stderr, "\nUnable to Get Initial Credentials: %s!\n",
fprintf(stderr, "root is not a valid Administrator\n!\n");
usage();
}
-
- (void) krb5_cc_close(context, cache);
}
+ (void) krb5_cc_close(context, cache);
}
usage()