add support for statically and dynamically linked libraries

remove 2 memleaks
This commit is contained in:
chris2511 2005-05-16 14:03:04 +00:00
parent 542d2981ab
commit dc15434e09
5 changed files with 33 additions and 16 deletions

View File

@ -18,9 +18,11 @@ bindir=bin
all: headers xca doc
re: clean all
xca: $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) $(LIBS) -o xca
#$(CC) $(CPPFLAGS) ../mingw/qt/lib/qt-mt230nc.lib ../mingw/qt/lib/qtmain.lib main.cpp -o main
xca.o: $(OBJECTS)
$(LD) $(LDFLAGS) $(OBJECTS) $(SLIBS) -r -o $@
xca: xca.o
$(CC) $(LDFLAGS) $< $(LIBS) -o $@
@echo -e "\n\n\nOk, compilation was successfull. \nNow do as root: 'make install'\n"
headers:

15
configure vendored
View File

@ -52,7 +52,11 @@ add_include() {
}
add_lib() {
LIBS="$LIBS -l$2"
if test "$3" = "a"; then
SLIBS="$SLIBS -l$2"
else
LIBS="$LIBS -l$2"
fi
for _libs in -L/usr/lib ${LDIRS}; do
if test "-L$1" = "${_libs}"; then
return 0
@ -80,9 +84,9 @@ search_includes() {
search_lib() {
for dir in ${DIRS}; do
for dbn in $@; do
for suffix in so dylib obj; do
for suffix in so dylib obj a; do
if test -r ${dir}/lib/lib${dbn}.${suffix}; then
add_lib ${dir}/lib ${dbn};
add_lib ${dir}/lib ${dbn} ${suffix};
echo Found: lib${dbn}.${suffix} at ${dir}/lib
return 0
fi
@ -165,6 +169,11 @@ CPPFLAGS=$CF
CFLAGS=${CFLAGS}
LDFLAGS=$LDIRS
# List of all libs to be compiled statically
SLIBS=$SLIBS
# list of dynamic libraries
LIBS=$LIBS
MOC=$MOC

View File

@ -6,15 +6,16 @@ all: doc
mandir=man
doc: xca.1.gz xca.html
xca.1.gz:
gzip -9 <xca.1 >$@
xca.1.gz: xca.1
gzip -9 <$^ >$@
xca.1:
cat xca.man |sed s/MY_VERSION/$(VERSION)/g >doc/xca.1
xca.1: xca.man
cat $^ | sed s/MY_VERSION/$(VERSION)/g > $@
xca.html: xca.sgml
linuxdoc -B html $< || true
install: xca.1.gz
install: xca.1.gz xca.html
install -m 755 -d $(destdir)$(prefix)/share/xca \
$(destdir)$(prefix)/$(mandir)/man1
install -m 644 xca*.html $(destdir)$(prefix)/share/xca

View File

@ -195,7 +195,7 @@ unsigned char *pki_x509req::toData(int *size)
}
void pki_x509req::writeDefault(const QString fname)
{
writeReq(fname + QDir::separator() + getIntName() + ".req", true);
writeReq(fname + QDir::separator() + getIntName() + ".csr", true);
}
void pki_x509req::writeReq(const QString fname, bool PEM)

View File

@ -104,13 +104,12 @@ QString x509name::getEntryByNid(int nid) const
QString x509name::getEntry(int i) const
{
QString s;
QString s, ret;
ASN1_STRING *d;
if ( i<0 || i>entryCount() ) return s;
d = X509_NAME_ENTRY_get_data(X509_NAME_get_entry(xn,i));
QString ret;
if (d->type == V_ASN1_BMPSTRING) {
for (int i=0;i<d->length;i+=2)
ret+=QChar((unsigned short)d->data[i]*256+
@ -120,6 +119,8 @@ QString x509name::getEntry(int i) const
ret=QString::fromUtf8((const char *)d->data,d->length);
else
ret=QString::fromLatin1((const char *)d->data,d->length);
ASN1_STRING_free(d);
return ret;
}
@ -142,8 +143,12 @@ QStringList x509name::entryList(int i) const
int x509name::nid(int i) const
{
X509_NAME_ENTRY *ne;
int nid;
ne = sk_X509_NAME_ENTRY_value(xn->entries, i);
return OBJ_obj2nid(ne->object);
nid = OBJ_obj2nid(ne->object);
X509_NAME_ENTRY_free(ne);
return nid;
}
unsigned char *x509name::d2i(const unsigned char *p, int size)