File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -149,8 +149,17 @@ def parse_cmdline():
149
149
print (_ ("Certificate file must be PEM or ASN.1" ),
150
150
file = sys .stderr )
151
151
152
+ # We must be passed a full path including target file
153
+ if not os .path .basename (options .cert_file ):
154
+ raise SSCGBadInputError ("Cert file path must include filename" )
155
+
156
+ if not os .path .basename (options .cert_key_file ):
157
+ raise SSCGBadInputError ("Key file path must include filename" )
158
+
152
159
if not options .ca_file :
153
160
options .ca_file = "{}/ca.crt" .format (os .path .dirname (options .cert_file ))
161
+ elif not os .path .basename (options .ca_file ):
162
+ raise SSCGBadInputError ("CA path must include filename" )
154
163
155
164
if options .debug :
156
165
# Dump all of the options so we see their values, including defaults
@@ -160,7 +169,11 @@ def parse_cmdline():
160
169
161
170
162
171
def main ():
163
- options = parse_cmdline ()
172
+ try :
173
+ options = parse_cmdline ()
174
+ except SSCGBadInputError :
175
+ print (_ ("Bad input on the command-line: {}" .format (sys .exc_info ()[1 ])))
176
+ sys .exit (1 )
164
177
165
178
try :
166
179
(ca_cert , ca_key ) = create_temp_ca (options )
You can’t perform that action at this time.
0 commit comments