[ovs-dev] [PATCH 04/10] ovs-pki: Workaround lack of /dev/stdin in Windows.
Ben Pfaff
blp at nicira.com
Wed May 14 23:23:25 UTC 2014
Yes. Thank you!
On May 14, 2014 4:03 PM, "Gurucharan Shetty" <shettyg at nicira.com> wrote:
> Like this? (There is a pre-existing check that $1 must exist)
>
> diff --git a/utilities/ovs-pki.in b/utilities/ovs-pki.in
> index 89af405..6081a5e 100755
> --- a/utilities/ovs-pki.in
> +++ b/utilities/ovs-pki.in
> @@ -461,9 +461,18 @@ sign_request() {
> must_not_exist "$2"
> pkidir_must_exist
>
> + case "$1" in
> + "/"*)
> + request_file="$1"
> + ;;
> + *)
> + request_file="`pwd`/$1"
> + ;;
> + esac
> +
> (cd "$pkidir/${type}ca" &&
> - openssl ca -config ca.cnf -batch -in /dev/stdin) \
> - < "$1" > "$2.tmp$$" 2>&3
> + openssl ca -config ca.cnf -batch -in "$request_file") \
> + > "$2.tmp$$" 2>&3
> mv "$2.tmp$$" "$2"
> }
>
> On Wed, May 14, 2014 at 3:46 PM, Ben Pfaff <blp at nicira.com> wrote:
> > I would use a shell case statement. It should be much cleaner.
> >
> > On May 14, 2014 3:45 PM, "Gurucharan Shetty" <shettyg at nicira.com> wrote:
> >>
> >> How about making the following assumption?
> >>
> >> diff --git a/utilities/ovs-pki.in b/utilities/ovs-pki.in
> >> index 7f56b4e..417fdf4 100755
> >> --- a/utilities/ovs-pki.in
> >> +++ b/utilities/ovs-pki.in
> >> @@ -461,7 +461,12 @@ sign_request() {
> >> must_not_exist "$2"
> >> pkidir_must_exist
> >>
> >> - request_file="`pwd`/$1"
> >> + if [ "`echo $1 | cut -c1`" = "/" ]; then
> >> + request_file="$1"
> >> + else
> >> + request_file="`pwd`/$1"
> >> + fi
> >> +
> >> (cd "$pkidir/${type}ca" &&
> >> openssl ca -config ca.cnf -batch -in "$request_file") \
> >> > "$2.tmp$$" 2>&3
> >>
> >> On Wed, May 14, 2014 at 12:58 PM, Ben Pfaff <blp at nicira.com> wrote:
> >> > On May 14, 2014 11:35 AM, "Gurucharan Shetty" <shettyg at nicira.com>
> >> > wrote:
> >> >>
> >> >> On Wed, May 14, 2014 at 11:18 AM, Ben Pfaff <blp at nicira.com> wrote:
> >> >> > On Tue, May 13, 2014 at 09:03:18AM -0700, Gurucharan Shetty wrote:
> >> >> >> This lets us generate certs for unit tests on Windows
> >> >> >>
> >> >> >> Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
> >> >> >
> >> >> > This will fail if $1 is absolute (if it begins with /):
> >> >> >> + request_file="`pwd`/$1"
> >> >> Reading the man page gave me an impression that 'name' is just a
> >> >> prefix. I guess not. I will fix it in v2.
> >> >
> >> > I think that it would most commonly be just a simple prefix, but i can
> >> > imagine a script calling ovs-pki with a fully qualified name as that
> >> > prefix.
> >> > Since (I guess) this worked before, I'd like it to continue working.
> >> >
> >> > Thanks,
> >> >
> >> > Ben.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20140514/1bcc00da/attachment-0005.html>
More information about the dev
mailing list