Network Utilities #66
Aliases: Network Utilities
27 verbs · 35 properties · 0 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
parse_address | this none this | rxd | #66 | 6 |
local_domain | this none this | rxd | #66 | 28 |
open | this none this | rxd | #66 | 24 |
close | this none this | rxd | #66 | 12 |
sendmail | any none none | rxd | #66 | 17 |
trust | this none this | rxd | #66 | 1 |
init_for_core | this none this | rxd | #66 | 17 |
raw_sendmail | any none none | rxd | #66 | 75 |
invalid_email_address | this none this | rxd | #66 | 25 |
invalid_hostname | this none this | rxd | #66 | 1 |
email_will_fail | this none this | rxd | #66 | 29 |
read | this none this | rxd | #66 | 10 |
is_open | this none this | rxd | #66 | 4 |
incoming_connection | this none this | rxd | #66 | 17 |
return_address_for | this none this | rxd | #66 | 10 |
server_started | this none this | rxd | #66 | 9 |
is_outgoing_connection | this none this | rxd | #66 | 1 |
notify | this none this | rxd | #66 | 9 |
suspend_if_needed | this none this | rxd | #66 | 5 |
error | this none this | rxd | #66 | 11 |
help_msg | this none this | rxd | #66 | 2 |
adjust_postmaster_for_password | this none this | rxd | #66 | 10 |
add_queued_mail | this none this | rxd | #66 | 14 |
send_queued_mail | this none this | rxd | #66 | 11 |
tcp_wait | this none this | rxd | #66 | 18 |
is_numeric_ip | this none this | rxd | #66 | 18 |
sendspam | any none none | rxd | #66 | 18 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
site | #66 | r | #361 | "yoursite" |
large_domains | #66 | r | #361 | {} |
connect_connections_to | #66 | | #361 | {} |
postmaster | #66 | rc | #361 | "postmastername@yourhost" |
port | #66 | rc | #361 | 7777 |
MOO_name | #66 | rc | #361 | "YourMOO" |
valid_host_regexp | #66 | rc | #361 | "^%([-_a-z0-9]+%.%)+%(gov%|edu%|com%|org%|int%|mil%|net%|%nato%|arpa%|[a-z][a-z]%)$" |
maildrop | #66 | rc | #361 | "localhost" |
trusts | #66 | r | #361 | {#29} |
active | #66 | rc | #361 | 0 |
valid_email_regexp | #66 | rc | #361 | "^[-a-z0-9_!.%+$'=/]*[-a-z0-9_!%+$'=]$" |
invalid_userids | #66 | rc | #361 | {"", "sysadmin", "root", "postmaster", "system", "operator", "bin"} |
debugging | #66 | rc | #361 | 0 |
errors_to_address | #66 | rc | #361 | "moomailerrors@yourhost" |
suspicious_userids | #66 | rc | #361 | list of 13{"", "sysadmin", "root", "postmaster", "bin", "SYSTEM", "OPERATOR", "guest", "me", "mailer-daemon", "webmaster", "sysop", "info"} |
usual_postmaster | #66 | rc | #361 | "postmastername@yourhost" |
password_postmaster | #66 | rc | #361 | "postmastername@yourhost" |
queued_mail | #66 | | #29 | {} |
queued_mail_task | #66 | r | #29 | 1076002766 |
envelope_from | #66 | rc | #361 | "postmastername@yourhost" |
blank_envelope | #66 | rc | #361 | 0 |
banned_email_domains | #66 | rc | #361 | list of 14{"mailinator.com", "finishhimjohnny.com", "spambob.com", "temporaryinbox.com", "spamify.com", "mail2rss.org", "spamfree24.org", "brockport.cainsight.com", "spamfree24.com", "mailinator.net", "mailinator2.com", "mailin8r.com", "guerrillamail.org", "mt2009.com"} |
boot_email_addresses | #66 | | #361 | {"jed@hellmoo.org"} |
localhost_equivalents | #66 | rc | #361 | list of 10{"mars", "localhost", "dlfsystems.com", "70.87.163.146", "mars.dlfsystems.com", "mars.tspigot.net", "localhost.localdomain", "fap1", "jupiter", "jupiter.tspigot.net"} |
help_msg | #72 | rc | #361 | <clear> |
aliases | #1 | rc | #361 | {"Network Utilities"} |
description | #1 | rc | #361 | list of 74{"Utilities for dealing with network connections", "---------------", "Creating & tracking hosts:", "", ":open(host, port [, connect-connection-to]) => connection", " open a network connection (using open_network_connection).", " If 'connect-connection-to' is a player object, the", " connection will be connected to that object when it", " gets the first line of input.", "", ":close(connection)", " closes the connection & cleans up data", "", "------------------", "Parsing network things:", "", ":invalid_email_address(email)", " return \"\" or string saying why 'email' is invalid.", " uses .valid_email_regexp", "", ":invalid_hostname(host)", " return \"\" or string saying why 'host' doesn't look", " like a valid internet host name", "", ":local_domain(host)", " returns the 'important' part of a host name, e.g.", " golden.parc.xerox.com => parc.xerox.com", "", "-------------------", "Sending mail", "", ":sendmail(to, subject, @lines)", " send mail to the email address 'to' with indicated subject.", " header fields like 'from', 'date', etc. are filled in.", " lines can start with additional header lines.", "", ":raw_sendmail(to, @lines)", " used by :sendmail. Send mail to given user at host, just", " as specified, no error checking.", "", "================================================================", "Parameters:", "", ".active If 0, disabled sending of mail.", "", ".site Where does this MOO run?", " (Maybe MOOnet will use it later).", "", ".port The network port this MOO listens on.", "", ".large_domains ", " A list of sites where more than 2 levels of host name are", " significant, e.g., if you want 'parc.xerox.com' to be", " different than 'cinops.xerox.com', put \"xerox.com\" as an", " element in .large_domains.", "", ".postmaster", " Email address to which problems with MOO mail should", " go. This should be a real email address that someone reads.", "", ".maildrop", " Hostname to connect to for dropping off mail. Usually can", " just be \"localhost\".", "", ".reply_address", " If a MOO character sends email, where does a reply go?", " Inserted in 'From:' for mail from characters without", " registration addresses. ", "", ".trusts", " List of (non-wizard) programmers who can call", " :open, :sendmail, :close", "", " "} |
object_size | #1 | r | #29 | {26946, 1298433815} |
hidden_verbs | #1 | rc | #361 | <clear> |
phelp_msg | #1 | rc | #361 | <clear> |
weight | #1 | rc | #361 | <clear> |
owner_verbs | #1 | rc | #361 | <clear> |
plural_name | #1 | rc | #361 | <clear> |
client_image | #1 | rc | #361 | <clear> |
listening | #1 | rc | #361 | <clear> |
Ancestry
Ancestors (nearest first): #72 Generic Utilities Package → #1 root
Children: none
Call graph
Source
parse_address
Referenced by
- #11:suspicious_address line 16:
$network:parse_address - #17:check_player_request line 42:
$network:parse_address - #66:email_will_fail line 17:
this:parse_address - #66:email_will_fail line 19:
this:parse_address
Source
1"Given an email address, return {userid, site}."; 2"Valid addresses are of the form `userid[@site]'."; 3"At least for now, if [@site] is left out, site will be returned as blank."; 4"Should be a default address site, or something, somewhere."; 5address = args[1]; 6return (at = index(address, "@")) ? {address[1..at - 1], address[at + 1..$]} | {address, ""};
local_domain
Referenced by
- #11:suspicious_address line 21:
$network:local_domain
Source
1"given a site, try to figure out what the `local' domain is."; 2"if site has a @ or a % in it, give up and return E_INVARG."; 3"blank site is returned as is; try this:local_domain(this.localhost) for the answer you probably want."; 4site = args[1]; 5if (index(site, "@") || index(site, "%")) 6return E_INVARG; 7elseif (match(site, "^[0-9.]+$")) 8return E_INVARG; 9elseif (!site) 10return ""; 11elseif (!(dot = rindex(site, "."))) 12dot = rindex(site = this.site, "."); 13endif 14if ((!dot) || (!(dot = rindex(site[1..dot - 1], ".")))) 15return site; 16else 17domain = site[dot + 1..$]; 18site = site[1..dot - 1]; 19while (site && (domain in this.large_domains)) 20if (dot = rindex(site, ".")) 21domain = tostr(site[dot + 1..$], ".", domain); 22site = site[1..dot - 1]; 23else 24return tostr(site, ".", domain); 25endif 26endwhile 27return domain; 28endif
open
Referenced by
- #66:raw_sendmail line 39:
$network:open - #69:get_now line 14:
$network:open - #69:show_text line 7:
$network:open - #80:open line 5:
$network:open - #80:open_data line 13:
$network:open - #90:get_remote line 19:
$network:open - #90:proxy line 32:
$network:open
Source
1":open(address, port, [connect-connection-to])"; 2"Open a network connection to address/port. If the connect-connection-to is passed, then the connection will be connected to that object when $login gets ahold of it. If not, then the connection is just ignored by $login, i.e. not bothered by it with $welcome_message etc."; 3"The object specified by connect-connection-to has to be a player (though it need not be a $player)."; 4"Returns the (initial) connection or an error, as in open_network_connection"; 5if (!this:trust(caller_perms())) 6return E_PERM; 7endif 8address = args[1]; 9port = args[2]; 10if (length(args) < 3) 11connect_to = $nothing; 12elseif ((typeof(connect_to = args[3]) == OBJ) && (valid(connect_to) && is_player(connect_to))) 13if (!$perm_utils:controls(caller_perms(), connect_to)) 14return E_PERM; 15endif 16else 17return E_INVARG; 18endif 19if (typeof(connection = `open_network_connection(address, port) ! ANY') != ERR) 20if (valid(connect_to)) 21this.connect_connections_to = {@this.connect_connections_to, {connection, connect_to}}; 22endif 23endif 24return connection;
close
Referenced by
- #66:raw_sendmail line 73:
$network:close - #69:get_now line 35:
$network:close - #69:show_text line 30:
$network:close - #80:open line 12:
$network:close - #80:close line 8:
$network:close - #80:close line 10:
$network:close - #80:close_data line 8:
$network:close
Source
1if (!this:trust(caller_perms())) 2return E_PERM; 3endif 4con = args[1]; 5if (!index(`connection_name(con) ! ANY => ""', " to ")) 6return E_INVARG; 7endif 8boot_player(con); 9if (i = $list_utils:iassoc(con, $network.connect_connections_to)) 10$network.connect_connections_to = listdelete($network.connect_connections_to, i); 11endif 12return 1;
sendmail
Referenced by
- #6:@registerme line 45:
$network:sendmail - #17:send_new_player_mail line 12:
$network:sendmail - #17:do_new_password line 26:
$network:sendmail - #17:send_new_password_mail line 10:
$network:sendmail - #17:reset_password line 16:
$network:sendmail - #33:send_self_netmail line 15:
$network:sendmail - #37:expire_old_messages line 14:
$network:sendmail - #37:@register line 34:
$network:sendmail - #66:server_started line 8:
$network:sendmail
Source
1"sendmail(to, subject, line1, line2, ...)"; 2" sends mail to internet address 'to', with given subject."; 3" It fills in various fields, such as date, from (from player), etc."; 4" the rest of the arguments are remaining lines of the message, and may begin with additional header fields."; 5" (must match RFC822 specification)."; 6"Requires $network.trust to call (no anonymous mail from MOO)."; 7"Returns 0 if successful, or else error condition or string saying why not."; 8if (!this:trust(caller_perms())) 9return E_PERM; 10endif 11mooname = this.MOO_name; 12mooinfo = tostr(mooname, " (", this.site, " ", this.port, ")"); 13if (reason = this:invalid_email_address(to = args[1])) 14return reason; 15endif 16"took out Envelope-from: + this.errors_to_address"; 17return this:raw_sendmail(to, "Date: " + ctime(), "From: " + this:return_address_for(player), "To: " + to, "Subject: " + args[2], "Errors-to: " + this.errors_to_address, "X-Mail-Agent: " + mooinfo, @args[3..$]);
trust
Referenced by
- #66:open line 5:
this:trust - #66:close line 1:
this:trust - #66:sendmail line 8:
this:trust - #66:read line 2:
this:trust - #66:notify line 2:
this:trust - #66:sendspam line 9:
this:trust
Source
1return (who = args[1]).wizard || (who in this.trusts);
init_for_core
Referenced by
none
Source
1if (caller_perms().wizard) 2pass(@args); 3this.active = 0; 4this.errors_to_address = "moomailerrors@yourhost"; 5this.site = "yoursite"; 6this.postmaster = "postmastername@yourhost"; 7this.usual_postmaster = "postmastername@yourhost"; 8this.password_postmaster = "postmastername@yourhost"; 9this.envelope_from = "postmastername@yourhost"; 10this.blank_envelope = 0; 11this.MOO_name = "YourMOO"; 12this.maildrop = "localhost"; 13this.port = 7777; 14this.large_domains = {}; 15this.trusts = {$hacker}; 16this.connect_connections_to = {}; 17endif
raw_sendmail
Referenced by
- #66:sendmail line 17:
this:raw_sendmail - #66:send_queued_mail line 5:
this:raw_sendmail - #66:sendspam line 18:
this:raw_sendmail
Source
1"Copied from sendmail fix (#88079):raw_sendmail by Lineman (#108318) Mon Feb 1 19:29:43 1999 PST"; 2"rawsendmail(to, @lines)"; 3"sends mail without processing. Returns 0 if successful, or else reason why not."; 4if (!caller_perms().wizard) 5return E_PERM; 6endif 7if (!this.active) 8return "Networking is disabled."; 9endif 10if (typeof(this.debugging) == LIST) 11"who to notify"; 12debugging = this.debugging; 13else 14"notify this owner"; 15debugging = this.debugging && {this.owner}; 16endif 17address = args[1]; 18body = listdelete(args, 1); 19if (body) 20for x in [1..length(body)] 21$cu:sin(); 22body[x] = $ansi:strip(body[x]); 23endfor 24endif 25data = {"HELO " + this.site, ("MAIL FROM:<" + this.postmaster) + ">", ("RCPT TO:<" + address) + ">", "DATA"}; 26blank = 0; 27for x in (body) 28yield; 29if (!(blank || match(x, "[a-z0-9-]*: "))) 30if (x) 31data = {@data, ""}; 32endif 33blank = 1; 34endif 35data = {@data, (x && (x[1] == ".")) ? "." + x | x}; 36endfor 37data = {@data, ".", "QUIT", ""}; 38suspend(0); 39target = $network:open(this.maildrop, 25); 40if (typeof(target) == ERR) 41return tostr("Cannot open connection to maildrop ", this.maildrop, ": ", target); 42endif 43set_connection_option(target, "hold-input", 1); 44blast = 0; 45msg = 0; 46expects = {"220", "250", "250", "250%|251", "354", "250", "221"}; 47for line in (data) 48if (!blast) 49reply = this:tcp_wait(target); 50if (typeof(reply) == ERR) 51msg = "Connection dropped or timed out."; 52break; 53elseif (!match(reply[1..3], expects[1])) 54msg = (("Expected " + expects[1]) + " but got ") + reply; 55break; 56endif 57debugging && notify(debugging[1], "GET: " + reply); 58expects[1..1] = {}; 59if (reply[1..3] == "221") 60"Service closing transmission channel"; 61break; 62elseif (reply[1..3] == "354") 63"Start mail input; end with <CRLF>.<CRLF>"; 64blast = 1; 65endif 66elseif (line == ".") 67blast = 0; 68endif 69debugging && notify(debugging[1], "SEND:" + line); 70notify(target, line); 71((ticks_left() < 4000) || (seconds_left() < 2)) && suspend(0); 72endfor 73$network:close(target); 74debugging && notify(debugging[1], "EXIT:" + (msg || "Mail sent successfully.")); 75return msg;
invalid_email_address
Referenced by
- #17:check_player_request line 39:
$network:invalid_email_address - #17:do_register line 16:
$network:invalid_email_address - #33:send_self_netmail line 5:
$network:invalid_email_address - #37:@register line 28:
$network:invalid_email_address - #66:sendmail line 13:
this:invalid_email_address - #66:email_will_fail line 3:
this:invalid_email_address - #66:sendspam line 14:
this:invalid_email_address
Source
1"invalid_email_address(email) -- check to see if email looks like a valid email address. Return reason why not."; 2address = args[1]; 3if (!address) 4return "no email address supplied"; 5endif 6if (!(at = rindex(address, "@"))) 7return ("'" + address) + "' doesn't look like a valid internet email address"; 8endif 9name = address[1..at - 1]; 10host = address[at + 1..$]; 11for b in (this.banned_email_domains) 12if (host == b) 13return tostr("'", host, "' is not an allowed domain (try a different email address)"); 14endif 15endfor 16if (match(name, "^in%%") || match(name, "^smtp%%")) 17return tostr("'", name, "' doesn't look like a valid username (try removing the 'in%' or 'smtp%')"); 18endif 19if (!match(host, $network.valid_host_regexp)) 20return tostr("'", host, "' doesn't look like a valid internet host"); 21endif 22if (!match(name, $network.valid_email_regexp)) 23return tostr("'", name, "' doesn't look like a valid user name for internet mail"); 24endif 25return "";
invalid_hostname
Referenced by
none
Source
1return match(args[1], this.valid_host_regexp) ? "" | tostr("'", args[1], "' doesn't look like a valid internet host name");
email_will_fail
Referenced by
- #33:@netforw*ard line 7:
$network:email_will_fail - #59:check_netmail line 8:
$network:email_will_fail
Source
1":email_will_fail(email-address[, display?]) => Makes sure the email-address is one that can actually be used by $network:sendmail()."; 2{email, ?display = 0} = args; 3reason = this:invalid_email_address(email); 4if (reason && display) 5player:tell("Invalid email address: ", reason); 6endif 7return reason; 8"following is code from OpalMOO, not used here"; 9"Possible situations where the address would be unusable are when the address is invalid or we can't connect to the site to send mail."; 10"If <display> is true, error messages are displayed to the player and 1 is returned when address is unuable. If <display> is false and address is unusable, the error message is returned. If the address is usable, 0 is always returned."; 11if (!this:approved_for_network(caller_perms())) 12return E_PERM; 13endif 14if (!this:valid_email_address(email)) 15msg = tostr("Your email address (", email, ") is not a usable account."); 16elseif ((result = this:verify_email_address(email)) == E_INVARG) 17msg = tostr("Unable to connect to ", this:parse_address(email)[2], "."); 18elseif (typeof(result) == STR) 19msg = tostr("The site ", (parse = this:parse_address(email))[2], " does not recognize ", parse[1], " as a valid account."); 20else 21return 0; 22endif 23if (display) 24player:tell(msg); 25return 1; 26else 27return msg; 28endif 29"Last modified Tue Jun 15 00:19:01 1993 EDT by Ranma (#200).";
read
Referenced by
- #80:wait_for_response line 9:
$network:read
Source
1"for trusted players, they can read from objects they own or open connections"; 2if (!this:trust(caller_perms())) 3return E_PERM; 4elseif (valid(x = args[1])) 5if ((x.owner == x) || (x.owner != caller_perms())) 6return E_INVARG; 7endif 8"elseif (!this:is_outgoing_connection(x) return E_PERM"; 9endif 10return `read(@args) ! ANY';
is_open
Referenced by
- #80:close line 9:
$network:is_open - #80:open_data line 6:
$network:is_open - #80:put_data line 7:
$network:is_open - #80:close_data line 5:
$network:is_open
Source
1":is_open(object)"; 2"return true if the object is somehow connected, false otherwise."; 3return typeof(`idle_seconds(@args) ! ANY') == INT; 4"Relies on test in idle_seconds, and the error catching";
incoming_connection
Referenced by
- #0:do_login_command line 18:
$network:incoming_connection
Source
1"Peer at an incoming connection. Decide if it should be connected to something, return that object. If it should be ignored (outbound connection), return 1. Called only by #0:do_login_command"; 2if (caller != #0) 3return; 4endif 5what = args[1]; 6"this code for unix servers >= 1.7.5 only"; 7if (index(`connection_name(what) ! ANY => ""', " to ")) 8"outbound connection"; 9if (ct = $list_utils:assoc(what, this.connect_connections_to)) 10this.connect_connections_to = setremove(this.connect_connections_to, ct); 11return ct[2]; 12else 13return 1; 14endif 15else 16return 0; 17endif
return_address_for
Referenced by
- #66:sendmail line 17:
this:return_address_for
Source
1":return_address_for(player) => string of 'return address'. Currently inbound mail doesn't work, so this is a bogus address."; 2who = args[1]; 3if (valid(who) && is_player(who)) 4if (who.wizard) 5return tostr(this.postmaster, "(", this.MOO_name, " help)"); 6endif 7return tostr(toint(who), "@", this.site, " (", who.name, ")"); 8else 9return tostr($login.registration_address, " (non-player ", who, ")"); 10endif
server_started
Referenced by
- #0:server_started line 3:
$network:server_started
Source
1"called when restarting to clean out state."; 2if (caller != #0) 3return E_PERM; 4endif 5this.connect_connections_to = {}; 6msg = tostr(this.MOO_name, " boot: ", ctime()[12..16], " v", server_version()[1..$ - 15]); 7for addr in (this.boot_email_addresses) 8$network:sendmail(addr, msg); 9endfor
is_outgoing_connection
Referenced by
- #66:notify line 6:
this:is_outgoing_connection
Source
1return index(`connection_name(args[1]) ! ANY => ""', " to ");
notify
Referenced by
- #80:do_command line 5:
$network:notify
Source
1"for trusted players, they can write to connections"; 2if (!this:trust(caller_perms())) 3return E_PERM; 4elseif (valid(x = args[1])) 5return E_INVARG; 6elseif (!this:is_outgoing_connection(x)) 7return E_PERM; 8endif 9return notify(x, args[2]);
suspend_if_needed
Referenced by
none
Source
1"$command_utils:suspend_if_needed but chowned to player"; 2if ($command_utils:running_out_of_time()) 3set_task_perms(caller_perms().wizard ? player | caller_perms()); 4return $command_utils:suspend_if_needed(@args); 5endif
error
Referenced by
none
Source
1":error(ERN, host, port) interpret open_network_connection(host, port) error"; 2{msg, host, port} = args; 3if (msg == E_PERM) 4return "Networking not enabled in server, or else user doesn't have permission to call o_n_c();"; 5elseif (msg == E_INVARG) 6return tostr("The host/port ", toliteral(host), "/", toliteral(port), " is invalid or is not responding."); 7elseif (msg == E_QUOTA) 8return tostr("The connection to ", toliteral(host), "/", toliteral(port), " cannot be made at this time."); 9else 10return tostr("Unusual error: ", toliteral(msg)); 11endif
help_msg
Referenced by
none
Source
1"'cause this doesn't have a $_utils name"; 2return this:description();
adjust_postmaster_for_password
Referenced by
- #17:do_new_password line 25:
$network:adjust_postmaster_for_password - #17:do_new_password line 31:
$network:adjust_postmaster_for_password - #17:reset_password line 15:
$network:adjust_postmaster_for_password - #17:reset_password line 18:
$network:adjust_postmaster_for_password
Source
1"adjust_postmaster_for_password(enter_or_exit): permits the MOO to have two different postmasters for different kinds of bounces. If entering password (argument \"enter\"), change to $network.password_postmaster, else (argument \"exit\") change to $network.usual_postmaster."; 2if (args[1] == "enter") 3$network.postmaster = $network.password_postmaster; 4$network.errors_to_address = $network.password_postmaster; 5$network.envelope_from = $network.password_postmaster; 6else 7$network.postmaster = $network.usual_postmaster; 8$network.errors_to_address = $network.usual_postmaster; 9$network.envelope_from = $network.blank_envelope ? "" | $network.usual_postmaster; 10endif
add_queued_mail
Referenced by
none
Source
1"$network:add_queued_mail( mail message )"; 2" -- where `mail message' is in the same format as passed to :raw_sendmail"; 3if (caller == this) 4this.queued_mail = {@this.queued_mail, {time(), args}}; 5if (!$code_utils:task_valid(this.queued_mail_task)) 6fork fid (3600) 7this:send_queued_mail(); 8endfork 9this.queued_mail_task = fid; 10endif 11return 1; 12else 13return E_PERM; 14endif
send_queued_mail
Referenced by
- #66:add_queued_mail line 7:
this:send_queued_mail
Source
1"$network:send_queued_mail()"; 2" -- tries to send the mail stored in the .queued_mail property"; 3while (queued_mail = this.queued_mail) 4message = queued_mail[1]; 5if (!this:raw_sendmail(@message[2])) 6this.queued_mail = setremove(this.queued_mail, message); 7else 8"wait an hour"; 9suspend(3600); 10endif 11endwhile
tcp_wait
Referenced by
- #66:raw_sendmail line 49:
this:tcp_wait
Source
1"Copied from sendmail fix (#88079):tcp_wait by Lineman (#108318) Mon Feb 1 19:28:18 1999 PST"; 2{conn, ?timeout = 0} = args; 3if (!caller_perms().wizard) 4return E_PERM; 5elseif (timeout) 6fork task (timeout) 7boot_player(conn); 8endfork 9endif 10while (1) 11if (typeof(line = `read(conn) ! ANY') == ERR) 12break; 13elseif (match(line, "^[0-9][0-9][0-9] ")) 14timeout && `kill_task(task) ! ANY'; 15break; 16endif 17endwhile 18return line;
is_numeric_ip
Referenced by
- #4:blacklisted line 10:
$network:is_numeric_ip - #4:blacklist_add*_temp line 8:
$network:is_numeric_ip - #4:blacklist_remove*_temp line 7:
$network:is_numeric_ip - #4:blacklisted_temp line 15:
$network:is_numeric_ip - #49:@blacklist line 36:
$network:is_numeric_ip
Source
1"Copied from Site DB (#25):domain_literal by Hacker (#36) Wed Apr 21 02:02:30 2010 CDT"; 2":domain_literal(string)"; 3" => true iff string is a domain literal (i.e., numeric IP address)."; 4if (10 <= (len = length(hnum = strsub(args[1], ".", "")))) 5return toint(hnum[1..9]) && toint(hnum[6..len]); 6else 7return toint(hnum); 8endif 9"SLEAZY CODE ALERT"; 10"... what I wanted to do was return toint(strsub(args[1],\".\",\"\"))"; 11"... but on a 32-bit machine, this has a 1 in 4294967296 chance of failing"; 12"... (e.g., on \"42.94.967.296\", though I'll grant this particular example"; 13"... entails some very strange subnetting on net 42, to say the least)."; 14"... So we do something that is guaranteed to work so long as internet"; 15"... addresses stay under 32 bits --- a while yet..."; 16""; 17"... As soon as we're sure match() is working, this will become a one-liner:"; 18return match(args[1], "[0-9]+%.[0-9]+%.[0-9]+%.[0-9]+");
sendspam
Referenced by
none
Source
1"Copied from Network Utilities (#72):sendmail by Satan (#2) Mon May 17 14:04:40 2010 CDT"; 2"sendmail(to, subject, line1, line2, ...)"; 3" sends mail to internet address 'to', with given subject."; 4" It fills in various fields, such as date, from (from player), etc."; 5" the rest of the arguments are remaining lines of the message, and may begin with additional header fields."; 6" (must match RFC822 specification)."; 7"Requires $network.trust to call (no anonymous mail from MOO)."; 8"Returns 0 if successful, or else error condition or string saying why not."; 9if (!this:trust(caller_perms())) 10return E_PERM; 11endif 12mooname = this.MOO_name; 13mooinfo = tostr(mooname, " (", this.site, " ", this.port, ")"); 14if (reason = this:invalid_email_address(to = args[1])) 15return reason; 16endif 17"took out Envelope-from: + this.errors_to_address"; 18return this:raw_sendmail(to, "Date: " + ctime(), ((("From: " + this.postmaster) + " (") + this.MOO_name) + ")", "To: " + to, "Subject: " + args[2], "Errors-to: " + this.errors_to_address, "X-Mail-Agent: " + mooinfo, @args[3..$]);