1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

r10513: Reduce some use of pstring. The main reason some parts of the code still

use pstring is next_token() now.
(This used to be commit a5b88bcd42)
This commit is contained in:
Jelmer Vernooij 2005-09-26 16:57:08 +00:00 committed by Gerald (Jerry) Carter
parent f801ad3592
commit 49839f356f
13 changed files with 23 additions and 53 deletions

View File

@ -24,7 +24,6 @@
#include "auth/auth.h"
#include "librpc/gen_ndr/ndr_samr.h"
#include "librpc/gen_ndr/ndr_security.h"
#include "pstring.h"
/**
* Return an error based on username
@ -46,9 +45,10 @@ static NTSTATUS name_to_ntstatus_check_password(struct auth_method_context *ctx,
{
NTSTATUS nt_status;
struct auth_serversupplied_info *server_info;
fstring user;
uint32_t error_num;
fstrcpy(user, user_info->client.account_name);
const char *user;
user = user_info->client.account_name;
if (strncasecmp("NT_STATUS", user, strlen("NT_STATUS")) == 0) {
nt_status = nt_status_string_to_code(user);

View File

@ -28,7 +28,6 @@
#include "system/time.h"
#include "auth/kerberos/kerberos.h"
#include "secrets.h"
#include "pstring.h"
#include "ads.h"
#ifdef HAVE_KRB5

View File

@ -30,7 +30,6 @@
#include "asn_1.h"
#include "lib/ldb/include/ldb.h"
#include "secrets.h"
#include "pstring.h"
#ifdef HAVE_KRB5

View File

@ -34,6 +34,7 @@
#include "dlinklist.h"
#include "credentials.h"
#include "system/readline.h"
#include "pstring.h"
#ifndef REGISTER
#define REGISTER 0

View File

@ -27,29 +27,4 @@
enum protocol_types {PROTOCOL_NONE,PROTOCOL_CORE,PROTOCOL_COREPLUS,PROTOCOL_LANMAN1,PROTOCOL_LANMAN2,PROTOCOL_NT1};
/* security levels */
enum security_types {SEC_SHARE,SEC_USER,SEC_SERVER,SEC_DOMAIN,SEC_ADS};
/* printing types */
enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX,
PRINT_QNX,PRINT_PLP,PRINT_LPRNG,PRINT_SOFTQ,
PRINT_CUPS,PRINT_LPRNT,PRINT_LPROS2
#ifdef DEVELOPER
,PRINT_TEST,PRINT_VLP
#endif /* DEVELOPER */
};
/* LDAP schema types */
enum schema_types {SCHEMA_COMPAT, SCHEMA_AD, SCHEMA_SAMBA};
/* LDAP SSL options */
enum ldap_ssl_types {LDAP_SSL_ON, LDAP_SSL_OFF, LDAP_SSL_START_TLS};
/* LDAP PASSWD SYNC methods */
enum ldap_passwd_sync_types {LDAP_PASSWD_SYNC_ON, LDAP_PASSWD_SYNC_OFF, LDAP_PASSWD_SYNC_ONLY};
/* Remote architectures we know about. */
enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT, RA_WIN2K, RA_WINXP, RA_SAMBA};
/* case handling */
enum case_handling {CASE_LOWER,CASE_UPPER};
enum security_types {SEC_SHARE,SEC_USER};

View File

@ -64,11 +64,6 @@
#include <varargs.h>
#endif
/* we support ADS if we want it and have krb5 and ldap libs */
#if defined(WITH_ADS) && defined(HAVE_KRB5) && defined(HAVE_LDAP)
#define HAVE_ADS
#endif
/* tell ldb we have the internal ldap code */
#define HAVE_ILDAP 1

View File

@ -22,7 +22,6 @@
#define _POPT_COMMON_H
#include "popt.h"
#include "pstring.h"
/* Common popt structures */
extern struct poptOption popt_common_samba[];

View File

@ -21,7 +21,6 @@
*/
#include "includes.h"
#include "pstring.h"
#include "system/filesys.h"
#ifndef O_NONBLOCK
@ -35,11 +34,13 @@ pid_t pidfile_pid(const char *name)
int fd;
char pidstr[20];
uint_t ret;
pstring pidFile;
char *pidFile;
slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_piddir(), name);
asprintf(&pidFile, "%s/%s.pid", lp_piddir(), name);
fd = open(pidFile, O_NONBLOCK | O_RDONLY, 0644);
SAFE_FREE(pidFile);
if (fd == -1) {
return 0;
}
@ -75,10 +76,10 @@ void pidfile_create(const char *name)
{
int fd;
char buf[20];
pstring pidFile;
char *pidFile;
pid_t pid;
slprintf(pidFile, sizeof(pidFile)-1, "%s/%s.pid", lp_piddir(), name);
asprintf(&pidFile, "%s/%s.pid", lp_piddir(), name);
pid = pidfile_pid(name);
if (pid != 0) {
@ -107,5 +108,7 @@ void pidfile_create(const char *name)
pidFile, strerror(errno)));
exit(1);
}
/* Leave pid file open & locked for the duration... */
SAFE_FREE(pidFile);
}

View File

@ -835,7 +835,7 @@ const char *get_nt_error_c_code(NTSTATUS nt_code)
/*****************************************************************************
returns the NT_STATUS constant matching the string supplied (as an NTSTATUS)
*****************************************************************************/
NTSTATUS nt_status_string_to_code(char *nt_status_str)
NTSTATUS nt_status_string_to_code(const char *nt_status_str)
{
int idx = 0;

View File

@ -297,11 +297,6 @@ static const struct enum_list enum_protocol[] = {
static const struct enum_list enum_security[] = {
{SEC_SHARE, "SHARE"},
{SEC_USER, "USER"},
{SEC_SERVER, "SERVER"},
{SEC_DOMAIN, "DOMAIN"},
#ifdef HAVE_ADS
{SEC_ADS, "ADS"},
#endif
{-1, NULL}
};

View File

@ -26,7 +26,6 @@
#include "lib/tdb/include/tdbutil.h"
#include "secrets.h"
#include "system/filesys.h"
#include "pstring.h"
#include "db_wrap.h"
#include "lib/ldb/include/ldb.h"
@ -57,21 +56,22 @@ void secrets_shutdown(void)
/* open up the secrets database */
BOOL secrets_init(void)
{
pstring fname;
char *fname;
uint8_t dummy;
if (tdb)
return True;
pstrcpy(fname, lp_private_dir());
pstrcat(fname,"/secrets.tdb");
asprintf(&fname, "%s/secrets.tdb", lp_private_dir());
tdb = tdb_wrap_open(talloc_autofree_context(), fname, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
if (!tdb) {
DEBUG(0,("Failed to open %s\n", fname));
SAFE_FREE(fname);
return False;
}
SAFE_FREE(fname);
/**
* Set a reseed function for the crypto random generator
@ -96,7 +96,7 @@ static void *secrets_fetch(const char *key, size_t *size)
secrets_init();
if (!tdb)
return NULL;
kbuf.dptr = strdup(key);
kbuf.dptr = (uint8_t *)strdup(key);
kbuf.dsize = strlen(key);
dbuf = tdb_fetch(tdb->tdb, kbuf);
if (size)

View File

@ -152,6 +152,9 @@ struct substitute_context {
char *user_name;
};
/* Remote architectures we know about. */
enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT, RA_WIN2K, RA_WINXP, RA_SAMBA};
/* smb server context structure. This should contain all the state
* information associated with a SMB server connection
*/

View File

@ -29,6 +29,7 @@
#include "auth/auth.h"
#include "librpc/gen_ndr/ndr_security.h"
#include "credentials.h"
#include "pstring.h"
#define SQUID_BUFFER_SIZE 2010