(01-04-2021, 01:00 PM)kop316 Wrote: That is right! so what you may need to do (I have had to do this for experiementing) is delete both the .mms/ and mms/ folder in your home folder. That usually cleans up those errors.
Please let me know what you did for getting the proxy!
I put a little hack to do_request() in mmsd/gweb/gweb.c. At ~line 1310, I inserted this:
Code:
.
.
if (session->address == NULL)
session->address = g_strdup(session->host);
/* Hack to prevent failure if proxy passed as text host name in */
/* session->address when a numeric IP is needed in this routine */
struct in_addr *inp; // dummy var for return
if(inet_aton(session->address,inp) == 0){
char *hostip;
struct hostent *hp;
debug(web,"session->address:%s not numeric ... trying to resolve host ...",session->address);
hp = gethostbyname(session->address);
if(hp==NULL){
debug(web,"Address host look-up failed.");
free_session(session);
return 0;
} else {
hostip = inet_ntoa( *(struct in_addr*)(hp->h_addr_list[0]));
debug(web,"Ip lookup: %s / %s",session->address,hostip);
session->address = hostip;
debug(web,"New session->address:%s",session->address);
}
}
/* end hack */
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_flags = AI_NUMERICHOST;
.
.
The code immediately following this populates session->addr with an addrinfo structure produced from session->address. The AI_NUMERICHOST flag requires session->address to be a numeric ip address, but whatever logic initially sets up the proxy session assigns the proxy string as provided in simple.c. So proxy would only work if the proxy host was specified as an ip address in simple.c.
My fix checks to see if session->address is in proper IP address format and if not, performs a hostname lookup and replaces the host name with the returned ip address. It works, but I don't really like the solution. If the input specifically *needs* to be a numeric ip address to correctly populate session->addr, the lookup should probably happen where the proxy information is assigned to session->address just like a non-proxy request.
If there *isn't* a specific reason the input needs to be a numeric address here, as best I can tell my fix is functionally redundant to simply commenting out the "hints.ai_flags = AI_NUMERICHOST;" line which would allow the getaddrinfo() call to resolve for either an ip address or text host name. Which, obviously, is a much cleaner solution.
Commenting out the flag did work to get mmsd talking to the proxy, but I'm not sure if changing the way that call works will break something for a different part of the system.