Пример #1
0
void
lock(char *user)
{
	char	tbuf[80];

	switch (maillock(user, 10)) {
	case L_SUCCESS:
	    return;
	case L_NAMELEN:
	    (void) snprintf(tbuf, sizeof (tbuf),
		"%s: Cannot create lock file. Username '%s' is > 13 chars\n",
		program, user);
	    break;
	case L_TMPLOCK:
	    strcpy(tbuf, "Cannot create temp lock file\n");
	    break;
	case L_TMPWRITE:
	    strcpy(tbuf, "Error writing pid to lock file\n");
	    break;
	case L_MAXTRYS:
	    strcpy(tbuf, "Creation of lockfile failed after 10 tries");
	    break;
	case L_ERROR:
	    strcpy(tbuf, "Cannot link temp lockfile to lockfile\n");
	    break;
	case L_MANLOCK:
	    strcpy(tbuf, "Cannot set mandatory file lock on temp lockfile\n");
	    break;
	}
	errmsg(E_LOCK, tbuf);
	if (sending) {
		goback(0);
	}
	done(0);
}
Пример #2
0
/*
 *	Print mail entries
 */
void
printmail()
{
	static char pn[] = "printmail";
	int	flg, curlet, showlet, k, print, aret, stret, rc;
	int	nsmbox = 0;	/* 1 ==> mailbox is in non-standard place */
	int	sav_j = -1;
	char	*p, *getarg();
	struct	stat stbuf;
	struct	stat *stbufp;
	int ttyf = isatty(1) ? TTY : ORDINARY;
	char	readbuf[LSIZE];	/* holds user's response in interactive mode */
	char	*resp;
	gid_t	savedegid;

	stbufp = &stbuf;

	/*
	 *	create working directory mbox name
	 */
	if ((hmbox = malloc(strlen(home) + strlen(mbox) + 1)) == NULL) {
		errmsg(E_MBOX, "");
		return;
	}
	cat(hmbox, home, mbox);

	/*
	 *	If we are not using an alternate mailfile, then get
	 *	the $MAIL value and build the filename for the mailfile.
	 *	If $MAIL is set, but is NOT the 'standard' place, then
	 *	use it but set flgf to circumvent :saved processing.
	 */
	if (!flgf) {
		if ((p = malloc(strlen(maildir) + strlen(my_name) + 1))
								== NULL) {
			errmsg(E_MEM, "");
			return;
		}
		cat(p, maildir, my_name);
		if (((mailfile = getenv("MAIL")) == NULL) ||
		    (strlen(mailfile) == 0)) {
			/* $MAIL not set, use standard path to mailfile */
			mailfile = p;
		} else {
			if (strcmp(mailfile, p) != 0) {
			    flgf = 1;
			    nsmbox = 1;
			    Dout(pn, 0, "$MAIL ('%s') != standard path\n",
				mailfile);
			    Dout("", 0, "\tSetting flgf to 1.\n");
			}
			free(p);
		}
	}

	/*
	 *	Get ACCESS and MODIFICATION times of mailfile BEFORE we
	 *	use it. This allows us to put them back when we are
	 *	done. If we didn't, the shell would think NEW mail had
	 *	arrived since the file times would have changed.
	 */
	stret = CERROR;
	if (access(mailfile, A_EXIST) == A_OK) {
		if ((stret = stat(mailfile, stbufp)) != A_OK) {
			errmsg(E_FILE, "Cannot stat mailfile");
			return;
		}
		mf_gid = stbufp->st_gid;
		mf_uid = stbufp->st_uid;
		utimep->actime = stbufp->st_atime;
		utimep->modtime = stbufp->st_mtime;
		file_size = stbufp->st_size;
	}

	/* Open the file as the real gid */
	savedegid = getegid();
	(void) setegid(getgid());
	malf = fopen(mailfile, "r");
	(void) setegid(savedegid);
	/*
	 *	stat succeeded, but we cannot access the mailfile
	 */
	if (stret == CSUCCESS && malf == NULL) {
		char buf[MAXFILENAME+50];
		(void) snprintf(buf, sizeof (buf),
		    "Invalid permissions on %s", mailfile);
		errmsg(E_PERM, buf);
		return;
	} else
	/*
	 *	using an alternate mailfile, but we failed on access
	 */
	if (!nsmbox && flgf && (malf == NULL)) {
		errmsg(E_FILE, "Cannot open mailfile");
		return;
	}
	/*
	 *	we failed to access OR the file is empty
	 */
	else if ((malf == NULL) || (stbuf.st_size == 0)) {
		if (!flge && !flgE) {
			printf("No mail.\n");
		}
		error = E_FLGE;
		Dout(pn, 0, "error set to %d\n", error);
		return;
	}
	if (flge)
		return;

	if (flgE) {
		if (utimep->modtime < utimep->actime) {
			error = E_FLGE_OM;
			Dout(pn, 0, "error set to %d\n", error);
		}
		return;
	}
	/*
	 *	Secure the mailfile to guarantee integrity
	 */
	lock(my_name);

	/*
	 *	copy mail to temp file and mark each letter in the
	 *	let array --- mailfile is still locked !!!
	 */
	mktmp();
	copymt(malf, tmpf);
	onlet = nlet;
	fclose(malf);
	fclose(tmpf);
	unlock();	/* All done, OK to unlock now */
	tmpf = doopen(lettmp, "r+", E_TMP);
	changed = 0;
	print = 1;
	curlet = 0;
	while (curlet < nlet) {
		/*
		 *	reverse order ?
		 */
		showlet = flgr ? curlet : nlet - curlet - 1;

		if (setjmp(sjbuf) == 0 && print != 0) {
				/* -h says to print the headers first */
				if (flgh) {
					gethead(showlet, 0);
					flgh = 0;	/* Only once */
					/* set letter # to invalid # */
					curlet--;
					showlet =
					    flgr ? curlet : nlet - curlet - 1;
				} else {
					if (showlet != sav_j) {
						/* Looking at new message. */
						/* Reset flag to override */
						/* non-display of binary */
						/* contents */
						sav_j = showlet;
						pflg = 0;
						Pflg = flgP;
					}
					copylet(showlet, stdout, ttyf);
				}
		}

		/*
		 *	print only
		 */
		if (flgp) {
			curlet++;
			continue;
		}
		/*
		 *	Interactive
		 */
		interactive = 1;
		setjmp(sjbuf);
		stat(mailfile, stbufp);
		if (stbufp->st_size != file_size) {
			/*
			 *	New mail has arrived, load it
			 */
			k = nlet;
			lock(my_name);
			malf = doopen(mailfile, "r", E_FILE);
			fclose(tmpf);
			tmpf = doopen(lettmp, "a", E_TMP);
			fseek(malf, let[nlet].adr, 0);
			copymt(malf, tmpf);
			file_size = stbufp->st_size;
			fclose(malf);
			fclose(tmpf);
			unlock();
			tmpf = doopen(lettmp, "r+", E_TMP);
			if (++k < nlet)
				printf("New mail loaded into letters %d - %d\n",
				    k, nlet);
			else
				printf("New mail loaded into letter %d\n",
				    nlet);
		}

		/* read the command */
		printf("? ");
		fflush(stdout);
		fflush(stderr);
		if (fgets(readbuf, sizeof (readbuf), stdin) == NULL) break;
		resp = readbuf;
		while (*resp == ' ' || *resp == '\t') resp++;
		print = 1;
		Dout(pn, 0, "resp = '%s'\n", resp);
		if ((rc = atoi(resp)) != 0) {
			if (!validmsg(rc)) print = 0;
			else curlet = flgr ? rc - 1 : nlet - rc;
		} else switch (resp[0]) {
			default:
				printf("Usage:\n");
			/*
			 *	help
			 */
			case '?':
				print = 0;
				for (rc = 0; help[rc]; rc++)
					printf("%s", help[rc]);
				break;
			/*
			 *	print message number of current message
			 */
			case '#':
				print = 0;
				if ((showlet == nlet) || (showlet < 0)) {
					printf("No message selected yet.\n");
				} else {
					printf("Current message number is %d\n",
					    showlet+1);
				}
				break;
			/*
			 *	headers
			 */
			case 'h':
				print = 0;
				if (resp[2] != 'd' &&
				    resp[2] != 'a' &&
				    (rc = getnumbr(resp+1)) > 0) {
					showlet = rc - 1;
					curlet = flgr ? rc - 1 : nlet - rc- 1;
				}
				if (rc == -1 && resp[2] != 'a' &&
				    resp[2] != 'd')
					break;
				if (resp[2] == 'a') rc = 1;
				else if (resp[2] == 'd') rc = 2;
					else rc = 0;

/*
 *				if (!validmsg(showlet)) break;
 */
				gethead(showlet, rc);
				break;
			/*
			 *	skip entry
			 */
			case '+':
			case 'n':
			case '\n':
				curlet++;
				break;
			case 'P':
				Pflg++;
				break;
			case 'p':
				pflg++;
				break;
			case 'x':
				changed = 0;
			case 'q':
				goto donep;
			/*
			 *	Previous entry
			 */
			case '^':
			case '-':
				if (--curlet < 0) curlet = 0;
				break;
			/*
			 *	Save in file without header
			 */
			case 'y':
			case 'w':
			/*
			 *	Save mail with header
			 */
			case 's':
				print = 0;
				if (!validmsg(curlet)) break;
				if (resp[1] == '\n' || resp[1] == '\0') {
					cat(resp+1, hmbox, "");
				} else if (resp[1] != ' ') {
					printf("Invalid command\n");
					break;
				}
				umask(umsave);
				flg = 0;
				if (getarg(lfil, resp + 1) == NULL) {
					cat(resp + 1, hmbox, "");
				}
				malf = (FILE *)NULL;
				p = resp + 1;
				while ((p = getarg(lfil, p)) != NULL) {
					if (flg) {
					    fprintf(stderr,
						"%s: File '%s' skipped\n",
						program, lfil);
					    continue;
					}
					malf = NULL;
					if ((aret = legal(lfil))) {
						malf = fopen(lfil, "a");
					}
					if ((malf == NULL) || (aret == 0)) {
					    fprintf(stderr,
						"%s: Cannot append to %s\n",
						program, lfil);
					    flg++;
					} else if (aret == 2) {
						chown(lfil, my_euid, my_gid);
					}
					if (!flg &&
					    copylet(showlet, malf, resp[0] ==
					    's'? ORDINARY: ZAP) == FALSE) {
						fprintf(stderr,
					    "%s: Cannot save mail to '%s'\n",
						    program, lfil);
						flg++;
					} else
						Dout(pn, 0, "!saved\n");
					if (malf != (FILE *)NULL) {
						fclose(malf);
					}
				}
				umask(7);
				if (!flg) {
					setletr(showlet, resp[0]);
					print = 1;
					curlet++;
				}
				break;
			/*
			 *	Reply to a letter
			 */
			case 'r':
				print = 0;
				if (!validmsg(curlet)) break;
				replying = 1;
				for (k = 1; resp[k] == ' ' || resp[k] == '\t';
				    ++k);
				resp[strlen(resp)-1] = '\0';
				(void) strlcpy(m_sendto, resp+k,
				    sizeof (m_sendto));
				goback(showlet);
				replying = 0;
				setletr(showlet, resp[0]);
				break;
			/*
			 *	Undelete
			 */
			case 'u':
				print = 0;
				if ((k = getnumbr(resp+1)) <= 0) k = showlet;
				else k--;
				if (!validmsg(k)) break;
				setletr(k, ' ');
				break;
			/*
			 *	Mail letter to someone else
			 */
			case 'm':
				{
				reciplist list;
				print = 0;
				if (!validmsg(curlet)) break;
				new_reciplist(&list);
				flg = 0;
				k = 0;
				if (substr(resp, " -") != -1 ||
					substr(resp, "\t-") != -1) {
					printf("Only users may be specified\n");
					break;
				}
				p = resp + 1;
				while ((p = getarg(lfil, p)) != NULL) {
					char *env;
					if (lfil[0] == '$') {
						if (!(env = getenv(&lfil[1]))) {
							fprintf(stderr,
				"%s: %s has no value or is not exported.\n",
							    program, lfil);
							flg++;
						} else
							add_recip(&list, env,
							    FALSE);
						k++;
					} else if (lfil[0] != '\0') {
						add_recip(&list, lfil, FALSE);
						k++;
					}
				}
				(void) strlcpy(Rpath, my_name, sizeof (Rpath));
				sending = TRUE;
				flg += sendlist(&list, showlet, 0);
				sending = FALSE;
				if (k) {
					if (!flg) {
						setletr(showlet, 'm');
						print = 1;
						curlet++;
					}
				} else
					printf("Invalid command\n");
				del_reciplist(&list);
				break;
				}
			/*
			 *	Read new letters
			 */
			case 'a':
				if (onlet == nlet) {
					printf("No new mail\n");
					print = 0;
					break;
				}
				curlet = 0;
				print = 1;
				break;
			/*
			 *	Escape to shell
			 */
			case '!':
				systm(resp + 1);
				printf("!\n");
				print = 0;
				break;
			/*
			 *	Delete an entry
			 */
			case 'd':
				print = 0;
				k = 0;
				if (strncmp("dq", resp, 2) != SAME &&
					strncmp("dp", resp, 2) != SAME)
					if ((k = getnumbr(resp+1)) == -1) break;
				if (k == 0) {
					k = showlet;
					if (!validmsg(curlet)) break;
					print = 1;
					curlet++;
				} else	k--;

				setletr(k, 'd');
				if (resp[1] == 'p') print = 1;
				else if (resp[1] == 'q') goto donep;
				break;
		}
	}
	/*
	 *	Copy updated mailfile back
	 */
donep:
	if (changed) {
		copyback();
		stamp();
	}
}
Пример #3
0
int protocol_arachne(struct HTTPrecord *cacheitem,struct Url *url,int *returnvalue)
{
 char *value;
#ifndef NOTCPIP
#ifndef CLEMTEST
  if(!strncmpi(url->file,"ftp-",4))
  {
   char back=1;

   if(!strncmpi(&(url->file[4]),"send",4))
    back=0;

   strcpy(url->user,configvariable(&ARACHNEcfg,"FTPusername",NULL));
   strcpy(url->password,configvariable(&ARACHNEcfg,"FTPpassword",NULL));
   strcpy(url->host,configvariable(&ARACHNEcfg,"FTPserver",NULL));
   strcpy(url->file,configvariable(&ARACHNEcfg,"FTPpath",NULL));
   url->port=21;

   if(tcpip)
    ftpsession(url,cacheitem,LASTlocname);

   if(!GLOBAL.gotolocation)
   {
    if(back)
     goback();
    else
     strcpy(GLOBAL.location,p->htmlframe[p->activeframe].cacheitem.URL);
    arachne.target=p->activeframe;
   }

   GLOBAL.reload=0;
   GLOBAL.postdata=0;
   return GOTO_IVEGOTNEWURL;
  }
#endif
#endif
#ifndef POSIX
  if(!strcmpi(url->file,"restart"))
  {
   char buf[IE_MAXLEN];
   char *ptr=getenv("ASETUP");

   if(ptr && !strcmp(ptr,"inst"))  //special case - "Finish Setup" button
    return GOTO_USEREND;

   arachne.target=0; //!!!
   strcpy(buf,"@arachne");
   if(tcpip)
    strcat(buf," -o\n");
   else
    strcat(buf,"\n");
   unlink("lock");
   *returnvalue=willexecute(buf);
   return GOTO_END;
  }
  else
#endif
 ///!!!!
 ///POSIX restart: TerminateArachne + exec.. (argv[0],argv[0],NULL) !
#ifndef NOTCPIP
  if(!strcmpi(url->file,"dialpage"))
  {
   value=configvariable(&ARACHNEcfg,"DialPage",NULL);

//!!glennmcc: Begin Feb 06, 2005 -- default to ppp_init.htm
//if 'DialPage' is missing from arachne.cfg
if(!value) value="file:ppp_init.htm";
//also use ppp_init.htm if DialPage does not begin with file:ppp
//indicating that it has been changed from one of the 4 included dialpages
//which are... ppp_init.htm, pppenhan.htm, pppframe.htm or ppp_fast.htm
//value=strlwr(value);
if(!strstr(value,"file:ppp")) value="file:ppp_init.htm";
//!!glennmcc: end

   if(value)
   {
    strcpy(GLOBAL.location,value);
    AnalyseURL(GLOBAL.location,url,IGNORE_PARENT_FRAME);
   }
  }
  else
#ifndef CLEMTEST
  if(!strcmpi(url->file,"dialer"))
  {
   *returnvalue=willexecute(ArachneDIAL());
   return GOTO_END;
  }
  else
  if(!strcmpi(url->file,"hangup"))
  {
   char buf[IE_MAXLEN];
   arachne.target=0; //!!!
   outs(MSG_HANGUP);
   if(reg && tcpip)
    PPPtimelog();
   process_form(0,IE_NULL); //updateovat Arachne.Cfg
   sprintf(buf,"%s\nif exist PPP.LOG del PPP.LOG\n",configvariable(&ARACHNEcfg,"Hangup",NULL));
   value=configvariable(&ARACHNEcfg,"ExitOnHangup",NULL);
   if(!(value && toupper(*value)=='Y'))
    strcat(buf,"@arachne -c\n");
   else
    exitmsg();
   *returnvalue=willexecute(buf);
   return GOTO_END;
  }
  else
#endif
#endif //NOTCPIP
  if(!strncmpi(url->file,"exit",4))
  {
   if(url->file[4]=='=' || url->file[4]=='?')
    *returnvalue=atoi(&(url->file[5]));
   return GOTO_USEREND;
  }
 return 0;
}
Пример #4
0
int protocol_nohttp(struct HTTPrecord *cacheitem,struct Url *url, unsigned *cacheitem_status, XSWAP *cacheitem_writeadr)
{
 char *value;

#ifndef CLEMTEST
#ifdef OVRL
#ifndef XTVERSION
 //---------------------------------------------------------------- finger:
 if(!strcmpi(url->protocol,"finger"))
 //------------------------------------------------------------------------
 {
  //finger to cache
  *cacheitem_writeadr=Write2Cache(url,cacheitem,1,1);
  strcpy(cacheitem->mime,"finger/out");
  if(xfinger(url,cacheitem,url->user))
  {
   if(GLOBAL.abort)
    return GOTO_ABORT;
   UpdateInCache(*cacheitem_writeadr,cacheitem);
   *cacheitem_status=REMOTE;
  }
  else
  {
   GLOBAL.reload=0;
   return GOTO_ABORT;
  }
 }
 else if(!strcmpi(url->protocol,"news") ||
         !strcmpi(url->protocol,"nntp") )
 {
  //finger to cache
  *cacheitem_writeadr=Write2Cache(url,cacheitem,1,1);

  if(!url->host[0])
  {
   value=configvariable(&ARACHNEcfg,"NNTPserver",NULL);
   if(value)
   {
    makestr(url->host,value,STRINGSIZE-1);
   }
  }

  if(!url->file[0] || url->file[0]=='/' && !url->file[1])
   strcpy(url->file,"LIST");

  strcpy(cacheitem->mime,"news/list");
  if(xfinger(url,cacheitem,url->file))
  {
   if(GLOBAL.abort)
    return GOTO_ABORT;
   UpdateInCache(*cacheitem_writeadr,cacheitem);
   *cacheitem_status=REMOTE;
  }
  else
  {
   GLOBAL.reload=0;
   return GOTO_ABORT;
  }
 }
 //---------------------------------------------------------------- gopher:
 else if(!strcmpi(url->protocol,"gopher"))
 //------------------------------------------------------------------------
 {
  char *selector;
  char dummy[IE_MAXLEN+1];

  int plugin=externalprotocol(url->protocol,dummy);
  if(plugin)
   return GOTO_EXTERNAL;

  //finger to cache
  *cacheitem_writeadr=Write2Cache(url,cacheitem,1,1);

  selector=&(url->file[1]);
  if(!url->file[1])
  {
   strcpy(cacheitem->mime,"gopher/1");
  }
  else if(url->file[2]=='/')
  {
   sprintf(cacheitem->mime,"gopher/%c",url->file[1]);
   if(url->file[1]=='7' && !strchr(url->file,'?')) //search
    return GOTO_TRYPLUGIN;
   selector=&(url->file[3]);
  }

  if(xfinger(url,cacheitem,selector))
  {
   if(GLOBAL.abort)
    return GOTO_ABORT;
   UpdateInCache(*cacheitem_writeadr,cacheitem);
   *cacheitem_status=REMOTE;
  }
  else
  {
   GLOBAL.reload=0;
   return GOTO_ABORT;
  }
 }
 else
#endif //XTVERSION
#endif //statical version
 //------------------------------------------------------------------- ftp:
 if(!strcmpi(url->protocol,"ftp"))
 //------------------------------------------------------------------------
 {
  char *ptr;
  char dummy[IE_MAXLEN+1];
  int plugin=externalprotocol(url->protocol,dummy);
  if(plugin)
   return GOTO_EXTERNAL;

  if(url->user[0] && !url->password[0] &&
     (strcmp(url->host,AUTHENTICATION->host) ||
      strcmp(url->user,AUTHENTICATION->user) ||
      strcmp(AUTHENTICATION->realm,"$ftp")))
  {
   sprintf(cacheitem->locname,"%s%sftplogin.ah",sharepath,GUIPATH);
   strcpy(AUTHENTICATION->host,url->host);
   return GOTO_LOCAL_HTML;
  }

  ptr=configvariable(&ARACHNEcfg,"UseFTPproxy",NULL);
  if(ptr && toupper(*ptr)!='N')
  {
   char *no4all=configvariable(&ARACHNEcfg,"NoFTPproxy4all",NULL);
   ptr=configvariable(&ARACHNEcfg,"NoFTPproxy",NULL);
   if((!ptr || !strstr(strlwr(ptr),strlwr(url->host) )) &&
      (!no4all || !strstr(strlwr(url->host), strlwr(no4all)) ) )
    return GOTO_PROXY;
  }

  //ftp to cache
  *cacheitem_writeadr=Write2Cache(url,cacheitem,1,1);

  if(ftpsession(url,cacheitem,NULL))
  {
   if(GLOBAL.abort)
    return GOTO_ABORT;
   UpdateInCache(*cacheitem_writeadr,cacheitem);
   *cacheitem_status=REMOTE;
  }
  else
  {
   GLOBAL.reload=0;
   return GOTO_ABORT;
  }
 }
 //------------------------------------------------------------------ pop3:
 else if(!strcmpi(url->protocol,"pop3"))
 //------------------------------------------------------------------------
 {
  char dele=1,log=0;

  if(!url->host[0])
  {
   value=configvariable(&ARACHNEcfg,"POP3server",NULL);
   if(value)
    makestr(url->host,value,STRINGSIZE-1);
  }
  if(!url->user[0])
  {
   value=configvariable(&ARACHNEcfg,"POP3username",NULL);
   if(value)
    makestr(url->user,value,STRINGSIZE-1);
  }

  //Draw title and URL (without password):

  MakeTitle(MSG_MAILDL);
  url2str(url,GLOBAL.location);
  SetInputAtom(&URLprompt,GLOBAL.location);
  DrawTitle(0);
  add2history(GLOBAL.location);

  //Get password and other settings:

  if(!url->password[0])
  {
   value=configvariable(&ARACHNEcfg,"POP3password",NULL);
   if(value)
    makestr(url->password,value,PASSWORDSIZE-1);
  }

  value=configvariable(&ARACHNEcfg,"KeepOnServer",NULL);
  if(value && toupper(*value)=='Y') dele=0;

  value=configvariable(&ARACHNEcfg,"POP3log",NULL);
  if(value && toupper(*value)=='Y') log=1;

  //POP3 download is performed here:

  if(!xpopdump(url,dele,log))
  {
   sprintf(p->htmlframe[0].cacheitem.locname,"%s%serr_pop3.ah",sharepath,GUIPATH);
   return GOTO_ERROR;
  }
  else if(arachne.scriptline==0)
  {
   value=configvariable(&ARACHNEcfg,"AfterPOP3",NULL);
   if(!value)
    strcpy(GLOBAL.location,"file://inbox.dgi");
   else
    strcpy(GLOBAL.location,value);
   GLOBAL.reload=RELOAD_CURRENT_LOCATION;
   return GOTO_IVEGOTNEWURL;
  }
  else
   return GOTO_READSCRIPT;
 }
 //------------------------------------------------------------------ smtp:
 else if(!strcmpi(url->protocol,"smtp"))
 //------------------------------------------------------------------------
 {
  char helo=1,log=0;

  if(!url->host[0])
  {
   value=configvariable(&ARACHNEcfg,"SMTPserver",NULL);
   if(value)
    makestr(url->host,value,STRINGSIZE-1);
  }

//!!glennmcc: Feb 13, 2006 -- 'SendHelo' is more logical ;-)
  value=configvariable(&ARACHNEcfg,"SendHELO",NULL);
  if(!value || toupper(*value)!='N') helo=1; else helo=0;
//  value=configvariable(&ARACHNEcfg,"NoHELO",NULL);
//  if(value && toupper(*value)=='Y') helo=0;
//!!glennmcc: end

  value=configvariable(&ARACHNEcfg,"SMTPlog",NULL);
  if(value && toupper(*value)=='Y') log=1;

//!!glennmcc: begin Nov 09, 2003 --- for Authenticated SMTP
//!!glennmcc: Feb 17, 2006 -- moved down below
/*
  value=configvariable(&ARACHNEcfg,"UseAuthSMTP",NULL);
  if(!value || toupper(*value)!='N') helo=2;
*/
//!!glennmcc: end

//!!glennmcc: begin Apr 30, 2004 --- for Authenticated SMTP
  value=configvariable(&ARACHNEcfg,"AuthSMTPusername",NULL);
//!!glennmcc: Sept 17, 2004
// changed so that "email" will always get used for "mail from"
//  if(value) makestr(url->user,value,STRINGSIZE-1);
  if(value) makestr(url->authuser,value,STRINGSIZE-1);
//!!glennmcc: end
  value=configvariable(&ARACHNEcfg,"AuthSMTPpassword",NULL);
//!!glennmcc: Feb 17, 2006 -- switch to new variable 'authpassword'
  if(value) makestr(url->authpassword,value,PASSWORDSIZE-1);
//if(value) makestr(url->password,value,STRINGSIZE-1);
//!!glennmcc: end
//!!glennmcc: Feb 17, 2006 -- switch to new variable 'authpassword'
if(strlen(url->authuser)>0 && strlen(url->authpassword)>0 &&
   strstr(configvariable(&ARACHNEcfg,"UseAuthSMTP",NULL),"Yes")
  )
   helo=2; else helo=1;
//!!glennmcc: end

  if(!url->user[0])
  {
   value=configvariable(&ARACHNEcfg,"eMail",NULL);
   makestr(url->user,value,STRINGSIZE-1);
  }

  if(!url->file[0] || !url->file[1] ) //stmp: or smtp:/
  {
   value=configvariable(&ARACHNEcfg,"MailPath",NULL);
   if(value)
   {
    sprintf(url->file,"/%s*.TBS",value);
   }
  }

  //Draw title and URL:

  MakeTitle(MSG_MAILUP);
  url2str(url,GLOBAL.location);
  SetInputAtom(&URLprompt,GLOBAL.location);
  DrawTitle(0);
  add2history(GLOBAL.location);

  //SMTP upload is performed here:

  if(!xsendmail(url,helo,log))

  {
   sprintf(p->htmlframe[0].cacheitem.locname,"%s%serr_smtp.ah",sharepath,GUIPATH);
   return GOTO_ERROR;
  }
  else if(arachne.scriptline==0)
  {
   if(strchr(url->file,'*') || GLOBAL.mailaction & MAIL_OUTBOXNOW)
   {
    value=configvariable(&ARACHNEcfg,"AfterSMTP",NULL);
    if(!value)
     strcpy(GLOBAL.location,"file://outbox.dgi");
    else
     strcpy(GLOBAL.location,value);
    GLOBAL.reload=RELOAD_CURRENT_LOCATION;
   }
   else
   {
//!!glennmcc: Feb 27, 2005
// since 'smtp:' is not being saved into history, 2 goback()s when we hit
// 'send mail now' on any of the mail compose screens ends-up taking us
// back one step too far.
// Therefore, we only goback once when it's not being sent 'on the spot'
    if(!strstr(GLOBAL.location,"smtp:")) goback(); //return to mailto: page...
//#ifdef NOKEY
//    goback();
//#endif
//!!glennmcc: end

    goback(); //return to page with <A HREF=mailto:...> tag...
    GLOBAL.postdata=0;

// RAY: This is done automaticaly now for inbox and outbox,
// see guivent.c
//    if(!strcmp(GLOBAL.location,"file://outbox.dgi"))
//     GLOBAL.reload=RELOAD_CURRENT_LOCATION;
//    else
//Ray: end
     GLOBAL.reload=NO_RELOAD;

   }
   return GOTO_IVEGOTNEWURL;
  }
  else
   return GOTO_READSCRIPT;
 }
 else
#endif //CLEMTEST
 //--------------------------------------------------------------- error?
  return UNKNOWN_PROTOCOL;
#ifndef CLEMTEST
 return CONTINUE_TO_RENDER;
#endif //CLEMTEST
}