summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornelsonb%netscape.com <devnull@localhost>2004-05-25 21:47:44 +0000
committernelsonb%netscape.com <devnull@localhost>2004-05-25 21:47:44 +0000
commita3cbf2199b39140602548055821bbe269a393543 (patch)
treef91220feb93b09da965ccde1e4ab7a30e547aa49
parent17bc27d5e2ae7a924e8363e27f1e543bbfcc90f1 (diff)
downloadnss-hg-a3cbf2199b39140602548055821bbe269a393543.tar.gz
a) adds the missing code to put stdin into binary mode.
b) add the -i option to the usage message c) builds addbuiltins with shared libs (includes "nssrenam.h" for some symbols) d) build addbuiltins as part of the normal builds.
-rw-r--r--security/nss/cmd/addbuiltin/addbuiltin.c36
-rw-r--r--security/nss/cmd/addbuiltin/manifest.mn3
-rw-r--r--security/nss/cmd/manifest.mn1
3 files changed, 30 insertions, 10 deletions
diff --git a/security/nss/cmd/addbuiltin/addbuiltin.c b/security/nss/cmd/addbuiltin/addbuiltin.c
index 9931fcead..520ff57ac 100644
--- a/security/nss/cmd/addbuiltin/addbuiltin.c
+++ b/security/nss/cmd/addbuiltin/addbuiltin.c
@@ -40,12 +40,18 @@
* $Id$
*/
+#include "nssrenam.h"
#include "nss.h"
#include "cert.h"
#include "certdb.h"
#include "secutil.h"
#include "pk11func.h"
+#if defined(WIN32)
+#include <fcntl.h>
+#include <io.h>
+#endif
+
void dumpbytes(unsigned char *buf, int len)
{
int i;
@@ -270,16 +276,16 @@ printheader() {
static void Usage(char *progName)
{
- fprintf(stderr, "%s -n nickname -t trust\n", progName);
+ fprintf(stderr, "%s -n nickname -t trust [-i certfile]\n", progName);
fprintf(stderr,
- "read a der-encoded cert from stdin in, and output\n"
- "it to stdout in a format suitable for the builtin root module.\n"
- "example: %s -n MyCA -t \"C,C,C\" < myca.der >> certdata.txt\n"
- "(pipe through atob if the cert is b64-encoded)\n");
- fprintf(stderr, "%15s nickname to assign to builtin cert.\n",
+ "\tRead a der-encoded cert from certfile or stdin, and output\n"
+ "\tit to stdout in a format suitable for the builtin root module.\n"
+ "\tExample: %s -n MyCA -t \"C,C,C\" -i myca.der >> certdata.txt\n"
+ "\t(pipe through atob if the cert is b64-encoded)\n", progName);
+ fprintf(stderr, "%-15s nickname to assign to builtin cert.\n",
"-n nickname");
- fprintf(stderr, "%15s default trust flags (cCTpPuw).\n",
- "-t trust");
+ fprintf(stderr, "%-15s trust flags (cCTpPuw).\n", "-t trust");
+ fprintf(stderr, "%-15s file to read (default stdin)\n", "-i certfile");
exit(-1);
}
@@ -331,6 +337,20 @@ main(int argc, char **argv)
exit(1);
}
} else {
+#if defined(WIN32)
+ /* If we're going to read binary data from stdin, we must put stdin
+ ** into O_BINARY mode or else incoming \r\n's will become \n's,
+ ** and latin-1 characters will be altered.
+ */
+
+ int smrv = _setmode(_fileno(stdin), _O_BINARY);
+ if (smrv == -1) {
+ fprintf(stderr,
+ "%s: Cannot change stdin to binary mode. Use -i option instead.\n",
+ progName);
+ exit(1);
+ }
+#endif
infile = PR_STDIN;
}
diff --git a/security/nss/cmd/addbuiltin/manifest.mn b/security/nss/cmd/addbuiltin/manifest.mn
index 0a30acb4c..0729834a7 100644
--- a/security/nss/cmd/addbuiltin/manifest.mn
+++ b/security/nss/cmd/addbuiltin/manifest.mn
@@ -46,8 +46,7 @@ CSRCS = \
# The MODULE is always implicitly required.
# Listing it here in REQUIRES makes it appear twice in the cc command line.
-REQUIRES = dbm seccmd
+REQUIRES = seccmd
PROGRAM = addbuiltin
-USE_STATIC_LIBS = 1
diff --git a/security/nss/cmd/manifest.mn b/security/nss/cmd/manifest.mn
index 7c8dc119d..de58f84c1 100644
--- a/security/nss/cmd/manifest.mn
+++ b/security/nss/cmd/manifest.mn
@@ -42,6 +42,7 @@ REQUIRES = nss nspr libdbm
DIRS = lib \
zlib \
+ addbuiltin \
atob \
bltest \
btoa \