This commit is contained in:
Craig Everett 2017-11-24 22:40:05 +09:00
parent cc4d55288d
commit e765209ee3

29
zx
View File

@ -1151,7 +1151,7 @@ prompt_keygen() ->
ok = io:format("Bad key name ~tp. Try again.~n", [KeyName]),
prompt_keygen();
{false, false} ->
ok = io:format("NUTS! Both the key and realm names are illegal. Try again.~n"),
ok = io:format("NUTS! Both key and realm names are illegal. Try again.~n"),
prompt_keygen()
end.
@ -1165,7 +1165,7 @@ create_keypair() ->
KeyID = prompt_keygen(),
case generate_rsa(KeyID) of
{ok, _, _} -> halt(0);
Error -> error_exit("create_keypair/0 failed with ~tp", [Error], ?FILE, ?LINE)
Error -> error_exit("create_keypair/0 error: ~tp", [Error], ?FILE, ?LINE)
end.
@ -1406,8 +1406,8 @@ create_realm() ->
Instructions =
"~n"
" Enter a name for your new realm.~n"
" Valid names can contain only lower-case letters, numbers and the underscore.~n"
" Valid names must begin with a lower-case letter.~n",
" Names can contain only lower-case letters, numbers and the underscore.~n"
" Names must begin with a lower-case letter.~n",
ok = io:format(Instructions),
Realm = get_input(),
case valid_lower0_9(Realm) of
@ -1440,6 +1440,7 @@ create_realm(Realm) ->
{error, einval} -> HostString
end,
PortInstructions =
"~n"
" Enter the port number the host will be listening on.~n"
" The port can be any number from 1 to 65535.~n"
" [Press enter for the default: 11311]~n",
@ -1468,8 +1469,8 @@ create_realm(Realm, Prime) ->
Instructions =
"~n"
" Enter a username for the realm sysop.~n"
" Valid names can contain only lower-case letters, numbers and the underscore.~n"
" Valid names must begin with a lower-case letter.~n",
" Names can contain only lower-case letters, numbers and the underscore.~n"
" Names must begin with a lower-case letter.~n",
ok = io:format(Instructions),
UserName = get_input(),
case valid_lower0_9(UserName) of
@ -1510,7 +1511,7 @@ create_realm(Realm, Prime, UserName) ->
create_realm(Realm, Prime, UserName, Email) ->
Instructions =
"~n"
" Enter the real name (or whatever name people will recognize) for the sysop.~n"
" Enter the real name (or whatever name people recognize) for the sysop.~n"
" There are no rules for this one. Any valid UTF-8 printables are legal.~n",
ok = io:format(Instructions),
RealName = get_input(),
@ -1531,13 +1532,13 @@ create_realm(Realm, Prime, UserName, Email) ->
halt(0);
false ->
{ok, _} = file:copy(From, To),
log(info, "Copying ~tp to the local directory", [From])
log(info, "Copying to local directory: ~ts", [From])
end
end,
Drop =
fun(File) ->
ok = file:delete(File),
log(info, "Deleting ~tp", [File])
log(info, "Deleting ~ts", [File])
end,
DangerousKeys = [PackageKey, SysopKey],
ok = lists:foreach(Copy, AllKeys),
@ -1546,11 +1547,11 @@ create_realm(Realm, Prime, UserName, Email) ->
"~n"
" All of the keys generated have been moved to the current directory.~n"
" MAKE AND SECURELY STORE COPIES OF THESE KEYS.~n"
" The private package key and private sysop login key have been deleted from the~n"
" zomp key directory. These should only exist on your local system, not a prime.~n"
" The private package and sysop login keys have been deleted from the~n"
" key directory. These should only exist on your local system, not a prime.~n"
" realm server (particularly if other services are run on that machine).~n"
" Your package and sysop keys will need to be copied to the ~~/.zomp/keys/~p/~n"
" directory on your personal or dev machine.",
" The package and sysop keys will need to be copied to the ~~/.zomp/keys/~p/~n"
" directory on your personal or dev machine.~n",
ok = io:format(Message, [Realm]),
Timestamp = calendar:now_to_universal_time(erlang:timestamp()),
UserRecord = {{UserName, Realm}, [SysopPub], Email, RealName, 1, Timestamp},
@ -1563,7 +1564,7 @@ create_realm(Realm, Prime, UserName, Email) ->
{sysops, [UserRecord]},
{realm_keys, [RealmPub]},
{package_keys, [PackagePub]}],
ok = log(info, "Would be writing ~tp", [RealmMeta]),
ok = log(info, "Would be writing~n ~tp", [RealmMeta]),
halt(0).