Skip to content
Snippets Groups Projects
Commit 19557fbb authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

The -mail option now allows user (non-Guest) access to their email

in the "mail" group, rather than sysop acccess to *all* email.

If any sysop actually wants the "all email" feature, that can be re-added
easy enough.

I *think* this is what Accession was asking for?
parent 1919c986
Branches
No related tags found
No related merge requests found
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
// -d debug output // -d debug output
// -f filter bogus client IP addresses // -f filter bogus client IP addresses
// -na no anonymous logins (requires user authentication) // -na no anonymous logins (requires user authentication)
// -mail expose entire mail database as newsgroup to Sysops // -mail expose user's email in "mail" newsgroup to non-Guest users
// -nolimit unlimited message lengths // -nolimit unlimited message lengths
// -notag do not append tear/tagline to local messages for Q-rest accounts // -notag do not append tear/tagline to local messages for Q-rest accounts
// -ascii convert ex-ASCII to ASCII // -ascii convert ex-ASCII to ASCII
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
// Netscape Communicator 4.77 // Netscape Communicator 4.77
// Xnews 5.04.25 // Xnews 5.04.25
const REVISION = "1.2"; const REVISION = "1.3";
var tearline = format("--- Synchronet %s%s-%s NNTP Service %s\r\n" var tearline = format("--- Synchronet %s%s-%s NNTP Service %s\r\n"
,system.version,system.revision,system.platform,REVISION); ,system.version,system.revision,system.platform,REVISION);
...@@ -141,6 +141,10 @@ function count_msgs(msgbase) ...@@ -141,6 +141,10 @@ function count_msgs(msgbase)
continue; continue;
if(idx.attr&MSG_VOTE) if(idx.attr&MSG_VOTE)
continue; continue;
if(msgbase.attributes & SMB_EMAIL) {
if(idx.to != user.number)
continue;
}
if(first == 0) if(first == 0)
first = idx.number; first = idx.number;
last = idx.number; last = idx.number;
...@@ -153,7 +157,7 @@ function get_newsgroup_list() ...@@ -153,7 +157,7 @@ function get_newsgroup_list()
{ {
// list of newsgroup names the logged-in user has access to // list of newsgroup names the logged-in user has access to
var newsgroup_list = []; var newsgroup_list = [];
if(include_mail) { if(include_mail && !(user.security.restrictions & UFLAG_G)) {
newsgroup_list.push("mail"); newsgroup_list.push("mail");
} }
for(var g in msg_area.grp_list) { for(var g in msg_area.grp_list) {
...@@ -295,7 +299,7 @@ while(client.socket.is_connected && !quit) { ...@@ -295,7 +299,7 @@ while(client.socket.is_connected && !quit) {
|| cmd[1].toUpperCase()=="ACTIVE") { // RFC 2980 2.1.2 || cmd[1].toUpperCase()=="ACTIVE") { // RFC 2980 2.1.2
pattern=cmd[2]; pattern=cmd[2];
writeln("215 list of newsgroups follows"); writeln("215 list of newsgroups follows");
if(include_mail && user.security.level == 99 && wildmatch("mail", pattern)) { if(include_mail && !(user.security.restrictions & UFLAG_G) && wildmatch("mail", pattern)) {
var mb=new MsgBase("mail"); var mb=new MsgBase("mail");
if(mb.open()==true) { if(mb.open()==true) {
writeln(format("mail %u %u n", mb.last_msg, mb.first_msg)); writeln(format("mail %u %u n", mb.last_msg, mb.first_msg));
...@@ -326,8 +330,8 @@ while(client.socket.is_connected && !quit) { ...@@ -326,8 +330,8 @@ while(client.socket.is_connected && !quit) {
else if(cmd[1].toUpperCase()=="NEWSGROUPS") { // RFC 2980 2.1.6 else if(cmd[1].toUpperCase()=="NEWSGROUPS") { // RFC 2980 2.1.6
pattern=cmd[2]; pattern=cmd[2];
writeln("215 list of newsgroups and descriptions follows"); writeln("215 list of newsgroups and descriptions follows");
if(include_mail && user.security.level == 99 && wildmatch("mail", pattern)) if(include_mail && !(user.security.restrictions & UFLAG_G) && wildmatch("mail", pattern))
writeln("mail complete mail database"); writeln("mail your email");
for(g in msg_area.grp_list) { for(g in msg_area.grp_list) {
for(s in msg_area.grp_list[g].sub_list) { for(s in msg_area.grp_list[g].sub_list) {
if(!wildmatch(msg_area.grp_list[g].sub_list[s].newsgroup, pattern)) if(!wildmatch(msg_area.grp_list[g].sub_list[s].newsgroup, pattern))
...@@ -369,8 +373,8 @@ while(client.socket.is_connected && !quit) { ...@@ -369,8 +373,8 @@ while(client.socket.is_connected && !quit) {
case "XGTITLE": case "XGTITLE":
pattern=cmd[2]; pattern=cmd[2];
writeln("282 list of newsgroups follows"); writeln("282 list of newsgroups follows");
if(include_mail && user.security.level == 99 && wildmatch("mail", pattern)) if(include_mail && !(user.security.restrictions & UFLAG_G) && wildmatch("mail", pattern))
writeln("mail complete mail database"); writeln("mail your email");
for(g in msg_area.grp_list) { for(g in msg_area.grp_list) {
for(s in msg_area.grp_list[g].sub_list) { for(s in msg_area.grp_list[g].sub_list) {
if(!wildmatch(msg_area.grp_list[g].sub_list[s].newsgroup, pattern)) if(!wildmatch(msg_area.grp_list[g].sub_list[s].newsgroup, pattern))
...@@ -465,7 +469,7 @@ while(client.socket.is_connected && !quit) { ...@@ -465,7 +469,7 @@ while(client.socket.is_connected && !quit) {
} }
found=true; found=true;
} }
else if(include_mail && user.security.level==99 && cmd[1].toLowerCase()=="mail") { else if(include_mail && !(user.security.restrictions & UFLAG_G) && cmd[1].toLowerCase()=="mail") {
if(msgbase && msgbase.is_open) if(msgbase && msgbase.is_open)
msgbase.close(); msgbase.close();
msgbase=new MsgBase("mail"); msgbase=new MsgBase("mail");
...@@ -519,6 +523,10 @@ while(client.socket.is_connected && !quit) { ...@@ -519,6 +523,10 @@ while(client.socket.is_connected && !quit) {
continue; continue;
if(idx.attr&MSG_VOTE) if(idx.attr&MSG_VOTE)
continue; continue;
if(msgbase.attributes & SMB_EMAIL) {
if(idx.to != user.number)
continue;
}
writeln(idx.number); writeln(idx.number);
} }
current_article = msgbase.first_msg; current_article = msgbase.first_msg;
...@@ -561,6 +569,10 @@ while(client.socket.is_connected && !quit) { ...@@ -561,6 +569,10 @@ while(client.socket.is_connected && !quit) {
continue; continue;
if(hdr.attr&MSG_VOTE) if(hdr.attr&MSG_VOTE)
continue; continue;
if(msgbase.attributes & SMB_EMAIL) {
if(hdr.to_ext != user.number)
continue;
}
writeln(format("%u\t%s\t%s\t%s\t%s\t%s\t%u\t%u\tXref:%s" writeln(format("%u\t%s\t%s\t%s\t%s\t%s\t%u\t%u\tXref:%s"
,i ,i
,get_news_subject(hdr) ,get_news_subject(hdr)
...@@ -611,6 +623,10 @@ while(client.socket.is_connected && !quit) { ...@@ -611,6 +623,10 @@ while(client.socket.is_connected && !quit) {
continue; continue;
if(hdr.attr&MSG_VOTE) if(hdr.attr&MSG_VOTE)
continue; continue;
if(msgbase.attributes & SMB_EMAIL) {
if(hdr.to_ext != user.number)
continue;
}
var field=""; var field="";
switch(cmd[1].toLowerCase()) { /* header */ switch(cmd[1].toLowerCase()) { /* header */
case "to": case "to":
...@@ -706,6 +722,31 @@ while(client.socket.is_connected && !quit) { ...@@ -706,6 +722,31 @@ while(client.socket.is_connected && !quit) {
current_article=hdr.number; current_article=hdr.number;
/* Eliminate dupe loops
if(user.security.restrictions&UFLAG_Q && hdr!=null)
*/
if(hdr.attr&MSG_DELETE) {
writeln("430 deleted message");
break;
}
if(hdr.attr&MSG_MODERATED && !(hdr.attr&MSG_VALIDATED)) {
writeln("430 unvalidated message");
break;
}
if(msgbase.attributes & SMB_EMAIL) {
if(hdr.to_ext != user.number) {
writeln("430 message not for you");
break;
}
} else {
if(hdr.attr&MSG_PRIVATE
&& hdr.to.toLowerCase()!=user.alias.toLowerCase()
&& hdr.to.toLowerCase()!=user.name.toLowerCase()) {
writeln("430 private message");
break;
}
}
if(cmd[0].toUpperCase()!="HEAD") { if(cmd[0].toUpperCase()!="HEAD") {
body=msgbase.get_msg_body(false,current_article body=msgbase.get_msg_body(false,current_article
,true /* remove ctrl-a codes */ ,true /* remove ctrl-a codes */
...@@ -731,24 +772,6 @@ while(client.socket.is_connected && !quit) { ...@@ -731,24 +772,6 @@ while(client.socket.is_connected && !quit) {
} }
} }
/* Eliminate dupe loops
if(user.security.restrictions&UFLAG_Q && hdr!=null)
*/
if(hdr.attr&MSG_DELETE) {
writeln("430 deleted message");
break;
}
if(hdr.attr&MSG_MODERATED && !(hdr.attr&MSG_VALIDATED)) {
writeln("430 unvalidated message");
break;
}
if(hdr.attr&MSG_PRIVATE
&& hdr.to.toLowerCase()!=user.alias.toLowerCase()
&& hdr.to.toLowerCase()!=user.name.toLowerCase()) {
writeln("430 private message");
break;
}
switch(cmd[0].toUpperCase()) { switch(cmd[0].toUpperCase()) {
case "ARTICLE": case "ARTICLE":
writeln(format("220 %d %s article retrieved - head and body follow",current_article,hdr.id)); writeln(format("220 %d %s article retrieved - head and body follow",current_article,hdr.id));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment