Bug 174672

Summary: inn's server_init sets TMPDIR; how rude!
Product: [Fedora] Fedora Reporter: Jonathan Kamens <h1k6zn2m>
Component: innAssignee: Martin Stransky <stransky>
Status: CLOSED UPSTREAM QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhide   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-12-20 14:22:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jonathan Kamens 2005-12-01 10:04:58 UTC
With inn-devel-2.4.2-4, if you link against libinn and call its server_init
function, you end up with TMPDIR set to /var/lib/news/tmp, which doesn't do much
good if you aren't running as root or news (which you probably aren't, if you're
a news client that links against libinn).

Demonstrate this by compiling and running the following problem with "gcc
-I/usr/include/inn -L/usr/lib/news/lib test.c -linn", with inn-devel installed:

#include <stdlib.h>
#include <libinn.h>
#include <stdio.h>

main()
{
  if (getenv("TMPDIR")) {
    printf("%s\n", getenv("TMPDIR"));
  }
  else {
    printf("before\n");
  }
  server_init("localhost", 119);
  if (getenv("TMPDIR")) {
    printf("%s\n", getenv("TMPDIR"));
  }
  
  else {
    printf("after\n");
  }
}

Library functions should not be setting TMPDIR.

Comment 1 Martin Stransky 2005-12-02 10:35:27 UTC
I'm going to consult it with upstream....

Comment 2 ptomblin 2005-12-02 16:16:03 UTC
The concept of a news client that talks directly to the server with libinn
rather than talking NNTP over a socket is so repellant that I hope this is
closed as "NOTABUG".  I would think libinn is meant more for people writing
server extensions, like spam filtering or the like.


Comment 3 Jonathan Kamens 2005-12-02 16:20:11 UTC
You are confused.  The routines I'm talking about in libinn are intended for 
clients to link against to talk to the server via NNTP.  They are a 
replacement for the old "clientlib.c" that was shipped with rrn and is the 
quasi-standard interface for Unix news clients to talk NNTP with a server.

Routines that are intended to be used by News clients shouldn't mess with 
TMPDIR.


Comment 4 Martin Stransky 2005-12-20 14:22:38 UTC
Reported to upstream, here is the reply from Russ Allbery:

"I plan on dropping all of the clientlib compatibility functions in the
next major release of INN.  INN really doesn't do a good enough job of
providing an NNTP library to warrant continuing to include them, and very
few programs use them.  (INN will eventually provide a different NNTP
library with a much different API, but that's another story.)"