summaryrefslogtreecommitdiffstats
path: root/ipa-server/ipa-kpasswd
diff options
context:
space:
mode:
Diffstat (limited to 'ipa-server/ipa-kpasswd')
-rw-r--r--ipa-server/ipa-kpasswd/Makefile5
-rw-r--r--ipa-server/ipa-kpasswd/ipa_kpasswd.c13
2 files changed, 16 insertions, 2 deletions
diff --git a/ipa-server/ipa-kpasswd/Makefile b/ipa-server/ipa-kpasswd/Makefile
index 11755a9a5..7384ed886 100644
--- a/ipa-server/ipa-kpasswd/Makefile
+++ b/ipa-server/ipa-kpasswd/Makefile
@@ -1,5 +1,6 @@
PREFIX ?= $(DESTDIR)/usr
SBIN = $(PREFIX)/sbin
+INITDIR = $(DESTDIR)/etc/rc.d/init.d
LDFLAGS +=-lkrb5 -llber -lldap
CFLAGS ?= -Wall -Wshadow -O2
@@ -15,8 +16,10 @@ all: $(OBJS)
install:
-mkdir -p $(SBIN)
install -m 755 ipa_kpasswd $(SBIN)
+ -mkdir -p $(INITDIR)
+ install -m 755 ipa-kpasswd.init $(INITDIR)/ipa-kpasswd
clean:
rm -f *.o
rm -f ipa_kpasswd
- rm -f *~ \ No newline at end of file
+ rm -f *~
diff --git a/ipa-server/ipa-kpasswd/ipa_kpasswd.c b/ipa-server/ipa-kpasswd/ipa_kpasswd.c
index 811ae34dc..bc89a1b84 100644
--- a/ipa-server/ipa-kpasswd/ipa_kpasswd.c
+++ b/ipa-server/ipa-kpasswd/ipa_kpasswd.c
@@ -21,6 +21,7 @@
#include <ldap.h>
#include <sasl/sasl.h>
+#define DEFAULT_KEYTAB "FILE:/var/kerberos/krb5kdc/kpasswd.keytab"
#define TMP_TEMPLATE "/tmp/kpasswd.XXXXXX"
#define KPASSWD_PORT 464
#define KPASSWD_TCP 1
@@ -108,7 +109,7 @@ int remove_blacklist(pid_t pid)
int debug = 1;
char *srv_pri_name = "kadmin/changepw";
-char *keytab_name = "FILE:/var/kerberos/krb5kdc/kpasswd.keytab";
+char *keytab_name = NULL;
static int get_krb5_ticket(char *tmp_file)
{
@@ -864,6 +865,16 @@ int main(int argc, char *argv[])
int tcp_s, udp_s;
int tru = 1;
int ret;
+ char *key;
+
+ key = getenv("KRB5_KTNAME");
+ if (!key) {
+ key = DEFAULT_KEYTAB;
+ }
+ keytab_name = strdup(key);
+ if (!keytab_name) {
+ fprintf(stderr, "Out of memory!\n");
+ }
tcp_s = socket(AF_INET, SOCK_STREAM, 0);
if (tcp_s == -1) {