lib: drop curlx_getpid, use fake pid in SMB

It was not a function properly exposed in the curlx set. SMB cannot
possibly need to send a real pid, now sends a made up number.

The only real users of this function are test servers, so move the logic
over there.

Closes #17298
This commit is contained in:
Daniel Stenberg 2025-05-09 09:36:05 +02:00
parent 5fef848037
commit a129859367
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
7 changed files with 12 additions and 15 deletions

View file

@ -470,12 +470,6 @@
#include <curl/stdcheaders.h>
#endif
#ifdef _WIN32
#define curlx_getpid() GetCurrentProcessId()
#else
#define curlx_getpid() getpid()
#endif
/*
* Large file (>2Gb) support using Win32 functions.
*/

View file

@ -596,7 +596,7 @@ static void smb_format_message(struct smb_conn *smbc,
struct smb_header *h,
unsigned char cmd, size_t len)
{
unsigned int pid;
const unsigned int pid = 0xbad71d; /* made up */
memset(h, 0, sizeof(*h));
h->nbt_length = htons((unsigned short) (sizeof(*h) - sizeof(unsigned int) +
@ -607,7 +607,6 @@ static void smb_format_message(struct smb_conn *smbc,
h->flags2 = smb_swap16(SMB_FLAGS2_IS_LONG_NAME | SMB_FLAGS2_KNOWS_LONG_NAME);
h->uid = smb_swap16(smbc->uid);
h->tid = smb_swap16(req->tid);
pid = (unsigned int)curlx_getpid();
h->pid_high = smb_swap16((unsigned short)(pid >> 16));
h->pid = smb_swap16((unsigned short) pid);
}