mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
fixed a bunch of compilation errors on Solaris, mostly people getting NSS_STATUS and WINBINDD error codes mixed up
(This used to be commit 66698d6b84
)
This commit is contained in:
parent
f6b531895e
commit
7deed93dd7
@ -704,40 +704,7 @@ typedef struct smb_wpasswd {
|
||||
#define UNI_XDIGIT 0x8
|
||||
#define UNI_SPACE 0x10
|
||||
|
||||
#ifdef HAVE_NSS_COMMON_H
|
||||
|
||||
/* Sun Solaris */
|
||||
|
||||
#include <nss_common.h>
|
||||
#include <nss_dbdefs.h>
|
||||
#include <nsswitch.h>
|
||||
|
||||
typedef nss_status_t NSS_STATUS;
|
||||
|
||||
#define NSS_STATUS_SUCCESS NSS_SUCCESS
|
||||
#define NSS_STATUS_NOTFOUND NSS_NOTFOUND
|
||||
#define NSS_STATUS_UNAVAIL NSS_UNAVAIL
|
||||
#define NSS_STATUS_TRYAGAIN NSS_TRYAGAIN
|
||||
|
||||
#elif HAVE_NSS_H
|
||||
|
||||
/* GNU */
|
||||
|
||||
#include <nss.h>
|
||||
|
||||
typedef enum nss_status NSS_STATUS;
|
||||
|
||||
#else /* Nothing's defined. Neither gnu nor sun */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NSS_STATUS_SUCCESS,
|
||||
NSS_STATUS_NOTFOUND,
|
||||
NSS_STATUS_UNAVAIL,
|
||||
NSS_STATUS_TRYAGAIN
|
||||
} NSS_STATUS;
|
||||
|
||||
#endif
|
||||
#include "nsswitch/nss.h"
|
||||
|
||||
/***** automatically generated prototypes *****/
|
||||
#include "proto.h"
|
||||
|
60
source3/nsswitch/nss.h
Normal file
60
source3/nsswitch/nss.h
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
Unix SMB/Netbios implementation.
|
||||
Version 2.0
|
||||
|
||||
a common place to work out how to define NSS_STATUS on various
|
||||
platforms
|
||||
|
||||
Copyright (C) Tim Potter 2000
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_NSS_COMMON_H
|
||||
|
||||
/* Sun Solaris */
|
||||
|
||||
#include <nss_common.h>
|
||||
#include <nss_dbdefs.h>
|
||||
#include <nsswitch.h>
|
||||
|
||||
typedef nss_status_t NSS_STATUS;
|
||||
|
||||
#define NSS_STATUS_SUCCESS NSS_SUCCESS
|
||||
#define NSS_STATUS_NOTFOUND NSS_NOTFOUND
|
||||
#define NSS_STATUS_UNAVAIL NSS_UNAVAIL
|
||||
#define NSS_STATUS_TRYAGAIN NSS_TRYAGAIN
|
||||
|
||||
#elif HAVE_NSS_H
|
||||
|
||||
/* GNU */
|
||||
|
||||
#include <nss.h>
|
||||
|
||||
typedef enum nss_status NSS_STATUS;
|
||||
|
||||
#else /* Nothing's defined. Neither gnu nor sun */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NSS_STATUS_SUCCESS=0,
|
||||
NSS_STATUS_NOTFOUND=1,
|
||||
NSS_STATUS_UNAVAIL=2,
|
||||
NSS_STATUS_TRYAGAIN=3
|
||||
} NSS_STATUS;
|
||||
|
||||
#endif
|
||||
|
@ -27,9 +27,9 @@
|
||||
|
||||
/* Prototypes from common.h */
|
||||
|
||||
enum nss_status winbindd_request(int req_type,
|
||||
struct winbindd_request *request,
|
||||
struct winbindd_response *response);
|
||||
NSS_STATUS winbindd_request(int req_type,
|
||||
struct winbindd_request *request,
|
||||
struct winbindd_response *response);
|
||||
|
||||
/* List groups a user is a member of */
|
||||
|
||||
@ -37,7 +37,8 @@ static BOOL wbinfo_get_usergroups(char *user)
|
||||
{
|
||||
struct winbindd_request request;
|
||||
struct winbindd_response response;
|
||||
int result, i;
|
||||
NSS_STATUS result;
|
||||
int i;
|
||||
|
||||
ZERO_STRUCT(response);
|
||||
|
||||
@ -69,8 +70,8 @@ static BOOL wbinfo_list_domains(void)
|
||||
|
||||
/* Send request */
|
||||
|
||||
if (winbindd_request(WINBINDD_LIST_TRUSTDOM, NULL, &response) ==
|
||||
WINBINDD_ERROR) {
|
||||
if (winbindd_request(WINBINDD_LIST_TRUSTDOM, NULL, &response) !=
|
||||
NSS_STATUS_SUCCESS) {
|
||||
return False;
|
||||
}
|
||||
|
||||
@ -126,8 +127,8 @@ static BOOL wbinfo_uid_to_sid(uid_t uid)
|
||||
/* Send request */
|
||||
|
||||
request.data.uid = uid;
|
||||
if (winbindd_request(WINBINDD_UID_TO_SID, &request, &response) ==
|
||||
WINBINDD_ERROR) {
|
||||
if (winbindd_request(WINBINDD_UID_TO_SID, &request, &response) !=
|
||||
NSS_STATUS_SUCCESS) {
|
||||
return False;
|
||||
}
|
||||
|
||||
@ -151,8 +152,8 @@ static BOOL wbinfo_gid_to_sid(gid_t gid)
|
||||
/* Send request */
|
||||
|
||||
request.data.gid = gid;
|
||||
if (winbindd_request(WINBINDD_GID_TO_SID, &request, &response) ==
|
||||
WINBINDD_ERROR) {
|
||||
if (winbindd_request(WINBINDD_GID_TO_SID, &request, &response) !=
|
||||
NSS_STATUS_SUCCESS) {
|
||||
return False;
|
||||
}
|
||||
|
||||
@ -176,8 +177,8 @@ static BOOL wbinfo_sid_to_uid(char *sid)
|
||||
/* Send request */
|
||||
|
||||
fstrcpy(request.data.sid, sid);
|
||||
if (winbindd_request(WINBINDD_SID_TO_UID, &request, &response) ==
|
||||
WINBINDD_ERROR) {
|
||||
if (winbindd_request(WINBINDD_SID_TO_UID, &request, &response) !=
|
||||
NSS_STATUS_SUCCESS) {
|
||||
return False;
|
||||
}
|
||||
|
||||
@ -199,8 +200,8 @@ static BOOL wbinfo_sid_to_gid(char *sid)
|
||||
/* Send request */
|
||||
|
||||
fstrcpy(request.data.sid, sid);
|
||||
if (winbindd_request(WINBINDD_SID_TO_GID, &request, &response) ==
|
||||
WINBINDD_ERROR) {
|
||||
if (winbindd_request(WINBINDD_SID_TO_GID, &request, &response) !=
|
||||
NSS_STATUS_SUCCESS) {
|
||||
return False;
|
||||
}
|
||||
|
||||
@ -224,8 +225,8 @@ static BOOL wbinfo_lookupsid(char *sid)
|
||||
/* Send off request */
|
||||
|
||||
fstrcpy(request.data.sid, sid);
|
||||
if (winbindd_request(WINBINDD_LOOKUPSID, &request, &response) ==
|
||||
WINBINDD_ERROR) {
|
||||
if (winbindd_request(WINBINDD_LOOKUPSID, &request, &response) !=
|
||||
NSS_STATUS_SUCCESS) {
|
||||
return False;
|
||||
}
|
||||
|
||||
@ -249,8 +250,8 @@ static BOOL wbinfo_lookupname(char *name)
|
||||
ZERO_STRUCT(response);
|
||||
|
||||
fstrcpy(request.data.name, name);
|
||||
if (winbindd_request(WINBINDD_LOOKUPNAME, &request, &response) ==
|
||||
WINBINDD_ERROR) {
|
||||
if (winbindd_request(WINBINDD_LOOKUPNAME, &request, &response) !=
|
||||
NSS_STATUS_SUCCESS) {
|
||||
return False;
|
||||
}
|
||||
|
||||
@ -267,7 +268,7 @@ static BOOL wbinfo_auth(char *username)
|
||||
{
|
||||
struct winbindd_request request;
|
||||
struct winbindd_response response;
|
||||
enum winbindd_result result;
|
||||
NSS_STATUS result;
|
||||
char *p;
|
||||
|
||||
/* Send off request */
|
||||
@ -290,9 +291,9 @@ static BOOL wbinfo_auth(char *username)
|
||||
/* Display response */
|
||||
|
||||
printf("plaintext password authentication %s\n",
|
||||
(result == WINBINDD_OK) ? "succeeded" : "failed");
|
||||
(result == NSS_STATUS_SUCCESS) ? "succeeded" : "failed");
|
||||
|
||||
return result == WINBINDD_OK;
|
||||
return result == NSS_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* Authenticate a user with a challenge/response */
|
||||
@ -301,7 +302,7 @@ static BOOL wbinfo_auth_crap(char *username)
|
||||
{
|
||||
struct winbindd_request request;
|
||||
struct winbindd_response response;
|
||||
enum winbindd_result result;
|
||||
NSS_STATUS result;
|
||||
fstring pass;
|
||||
char *p;
|
||||
|
||||
@ -322,10 +323,10 @@ static BOOL wbinfo_auth_crap(char *username)
|
||||
|
||||
generate_random_buffer(request.data.auth_crap.chal, 8, False);
|
||||
|
||||
SMBencrypt(pass, request.data.auth_crap.chal,
|
||||
request.data.auth_crap.lm_resp);
|
||||
SMBNTencrypt(pass, request.data.auth_crap.chal,
|
||||
request.data.auth_crap.nt_resp);
|
||||
SMBencrypt((uchar *)pass, request.data.auth_crap.chal,
|
||||
(uchar *)request.data.auth_crap.lm_resp);
|
||||
SMBNTencrypt((uchar *)pass, request.data.auth_crap.chal,
|
||||
(uchar *)request.data.auth_crap.nt_resp);
|
||||
|
||||
request.data.auth_crap.lm_resp_len = 24;
|
||||
request.data.auth_crap.nt_resp_len = 24;
|
||||
@ -335,9 +336,9 @@ static BOOL wbinfo_auth_crap(char *username)
|
||||
/* Display response */
|
||||
|
||||
printf("challenge/response password authentication %s\n",
|
||||
(result == WINBINDD_OK) ? "succeeded" : "failed");
|
||||
(result == NSS_STATUS_SUCCESS) ? "succeeded" : "failed");
|
||||
|
||||
return result == WINBINDD_OK;
|
||||
return result == NSS_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* Print domain users */
|
||||
@ -351,8 +352,8 @@ static BOOL print_domain_users(void)
|
||||
|
||||
ZERO_STRUCT(response);
|
||||
|
||||
if (winbindd_request(WINBINDD_LIST_USERS, NULL, &response) ==
|
||||
WINBINDD_ERROR) {
|
||||
if (winbindd_request(WINBINDD_LIST_USERS, NULL, &response) !=
|
||||
NSS_STATUS_SUCCESS) {
|
||||
return False;
|
||||
}
|
||||
|
||||
@ -379,8 +380,8 @@ static BOOL print_domain_groups(void)
|
||||
|
||||
ZERO_STRUCT(response);
|
||||
|
||||
if (winbindd_request(WINBINDD_LIST_GROUPS, NULL, &response) ==
|
||||
WINBINDD_ERROR) {
|
||||
if (winbindd_request(WINBINDD_LIST_GROUPS, NULL, &response) !=
|
||||
NSS_STATUS_SUCCESS) {
|
||||
return False;
|
||||
}
|
||||
|
||||
|
@ -59,39 +59,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
#include <pwd.h>
|
||||
|
||||
#ifdef HAVE_NSS_COMMON_H
|
||||
/* Sun Solaris */
|
||||
|
||||
#include <nss_common.h>
|
||||
#include <nss_dbdefs.h>
|
||||
#include <nsswitch.h>
|
||||
|
||||
typedef nss_status_t NSS_STATUS;
|
||||
|
||||
#define NSS_STATUS_SUCCESS NSS_SUCCESS
|
||||
#define NSS_STATUS_NOTFOUND NSS_NOTFOUND
|
||||
#define NSS_STATUS_UNAVAIL NSS_UNAVAIL
|
||||
#define NSS_STATUS_TRYAGAIN NSS_TRYAGAIN
|
||||
|
||||
#elif HAVE_NSS_H
|
||||
/* GNU */
|
||||
|
||||
#include <nss.h>
|
||||
|
||||
typedef enum nss_status NSS_STATUS;
|
||||
|
||||
#else /* Nothing's defined. Neither gnu nor sun */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
NSS_STATUS_SUCCESS,
|
||||
NSS_STATUS_NOTFOUND,
|
||||
NSS_STATUS_UNAVAIL,
|
||||
NSS_STATUS_TRYAGAIN
|
||||
} NSS_STATUS;
|
||||
|
||||
#endif
|
||||
#include "nsswitch/nss.h"
|
||||
|
||||
/* Declarations for functions in winbind_nss.c
|
||||
needed in winbind_nss_solaris.c (solaris wrapper to nss) */
|
||||
|
@ -34,7 +34,7 @@ static TDB_CONTEXT *idmap_tdb;
|
||||
|
||||
/* Allocate either a user or group id from the pool */
|
||||
|
||||
static BOOL allocate_id(int *id, BOOL isgroup)
|
||||
static BOOL allocate_id(uid_t *id, BOOL isgroup)
|
||||
{
|
||||
int hwm;
|
||||
|
||||
@ -68,7 +68,7 @@ static BOOL allocate_id(int *id, BOOL isgroup)
|
||||
|
||||
/* Get an id from a rid */
|
||||
|
||||
static BOOL get_id_from_rid(char *domain_name, uint32 rid, int *id,
|
||||
static BOOL get_id_from_rid(char *domain_name, uint32 rid, uid_t *id,
|
||||
BOOL isgroup)
|
||||
{
|
||||
TDB_DATA data, key;
|
||||
|
@ -101,7 +101,7 @@ struct winbindd_request {
|
||||
fstring pass;
|
||||
} auth; /* pam_winbind auth module */
|
||||
struct {
|
||||
char chal[8];
|
||||
unsigned char chal[8];
|
||||
fstring user;
|
||||
fstring lm_resp;
|
||||
uint16 lm_resp_len;
|
||||
|
@ -94,11 +94,12 @@ static BOOL winbindd_fill_pwent(char *domain_name, char *name,
|
||||
enum winbindd_result winbindd_getpwnam_from_user(struct winbindd_cli_state
|
||||
*state)
|
||||
{
|
||||
uint32 name_type, user_rid, group_rid;
|
||||
uint32 user_rid, group_rid;
|
||||
SAM_USERINFO_CTR *user_info;
|
||||
DOM_SID user_sid;
|
||||
fstring name_domain, name_user, name, gecos_name;
|
||||
struct winbindd_domain *domain;
|
||||
enum SID_NAME_USE name_type;
|
||||
|
||||
DEBUG(3, ("[%5d]: getpwnam %s\n", state->pid,
|
||||
state->request.data.username));
|
||||
|
Loading…
Reference in New Issue
Block a user