Skip to content

Commit

Permalink
Add internal path expansion functions
Browse files Browse the repository at this point in the history
Add an adapted version of Heimdal's expand_path.c, defining
k5_expand_path_tokens() and k5_expand_path_tokens_extra().  These
functions allow template paths like %{TEMP}/krb5cc_%{uid} to be
resolved.  Also add a test program to exercise the path expansion
code.
  • Loading branch information
greghudson committed Jul 24, 2012
1 parent 69c87a9 commit 7d07dc6
Show file tree
Hide file tree
Showing 5 changed files with 577 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/lib/krb5/libkrb5.exports
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ k5_ccselect_free_context
k5_copy_etypes
k5_count_etypes
k5_etypes_contains
k5_expand_path_tokens
k5_expand_path_tokens_extra
k5_free_serverlist
k5_kt_get_principal
k5_locate_kdc
Expand Down
23 changes: 19 additions & 4 deletions src/lib/krb5/os/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ KRB5_RUN_ENV = @KRB5_RUN_ENV@
PROG_LIBPATH=-L$(TOPLIBD)
PROG_RPATH=$(KRB5_LIBDIR)
DEFS=
DEFINES=-DLIBDIR=\"$(KRB5_LIBDIR)\"
DEFINES=-DLIBDIR=\"$(KRB5_LIBDIR)\" -DBINDIR=\"$(CLIENT_BINDIR)\" \
-DSBINDIR=\"$(ADMIN_BINDIR)\"
LOCALINCLUDES=-I$(top_srcdir)/util/profile

##DOS##BUILDTOP = ..\..\..
Expand All @@ -21,6 +22,7 @@ STLIBOBJS= \
cm.o \
dnsglue.o \
dnssrv.o \
expand_path.o \
free_krbhs.o \
full_ipadr.o \
get_krbhst.o \
Expand Down Expand Up @@ -65,6 +67,7 @@ OBJS= \
$(OUTPRE)cm.$(OBJEXT) \
$(OUTPRE)dnsglue.$(OBJEXT) \
$(OUTPRE)dnssrv.$(OBJEXT) \
$(OUTPRE)expand_path.$(OBJEXT) \
$(OUTPRE)free_krbhs.$(OBJEXT) \
$(OUTPRE)full_ipadr.$(OBJEXT) \
$(OUTPRE)get_krbhst.$(OBJEXT) \
Expand Down Expand Up @@ -109,6 +112,7 @@ SRCS= \
$(srcdir)/cm.c \
$(srcdir)/dnsglue.c \
$(srcdir)/dnssrv.c \
$(srcdir)/expand_path.c \
$(srcdir)/free_krbhs.c \
$(srcdir)/full_ipadr.c \
$(srcdir)/get_krbhst.c \
Expand Down Expand Up @@ -144,7 +148,7 @@ SRCS= \
$(srcdir)/write_msg.c

EXTRADEPSRCS = \
t_an_to_ln.c t_gifconf.c t_locate_kdc.c \
t_an_to_ln.c t_expand_path.c t_gifconf.c t_locate_kdc.c \
t_std_conf.c

##DOS##LIBOBJS = $(OBJS)
Expand All @@ -155,7 +159,7 @@ clean-unix:: clean-libobjs
shared:
mkdir shared

TEST_PROGS= t_std_conf t_an_to_ln t_kuserok t_locate_kdc t_trace
TEST_PROGS= t_std_conf t_an_to_ln t_kuserok t_locate_kdc t_trace t_expand_path

T_STD_CONF_OBJS= t_std_conf.o

Expand Down Expand Up @@ -188,6 +192,9 @@ $(OUTPRE)t_locate_kdc.exe: $(OUTPRE)t_locate_kdc.obj \
t_trace: $(T_TRACE_OBJS) $(KRB5_BASE_DEPLIBS)
$(CC_LINK) -o t_trace $(T_TRACE_OBJS) $(KRB5_BASE_LIBS)

t_expand_path: t_expand_path.o $(KRB5_BASE_DEPLIBS)
$(CC_LINK) -o $@ t_expand_path.o $(KRB5_BASE_LIBS)

LCLINT=lclint
LCLINTOPTS= -warnposix \
-usedef +charintliteral +ignoresigns -predboolint +boolint \
Expand All @@ -198,7 +205,7 @@ lclint-localaddr: localaddr.c
-DTEST $(srcdir)/localaddr.c

check-unix:: check-unix-stdconf check-unix-locate check-unix-antoln \
check-unix-trace t_kuserok
check-unix-trace check-unix-expand t_kuserok

check-unix-stdconf:: t_std_conf
KRB5_CONFIG=$(srcdir)/td_krb5.conf ; export KRB5_CONFIG ;\
Expand Down Expand Up @@ -267,6 +274,14 @@ check-unix-trace:: t_trace
sed -e 's/^[^:]*: //' t_trace.out | cmp - $(srcdir)/t_trace.ref
rm -f t_trace.out

check-unix-expand:: t_expand_path
$(KRB5_RUN_ENV) $(VALGRIND) ./t_expand_path '%{null}' ''
$(KRB5_RUN_ENV) $(VALGRIND) ./t_expand_path ' %{BINDIR}%{LIBDIR} ' \
' $(CLIENT_BINDIR)$(KRB5_LIBDIR) '
$(KRB5_RUN_ENV) $(VALGRIND) ./t_expand_path \
'the %{animal}%{s} on the %{place}%{s}' \
'the frogs on the pads'

clean::
$(RM) $(TEST_PROGS) test.out t_std_conf.o t_an_to_ln.o t_locate_kdc.o
$(RM) t_kuserok.o
Expand Down

0 comments on commit 7d07dc6

Please sign in to comment.