SAMBA - how to get client IP












0














I tried to get the client IP with SAMBA by:



char *client_ip = tsocket_address_inet_addr_string(handle->conn->sconn->remote_address, talloc_tos());


From looking at their source code, I see that sconn can be NULL (and I am getting NULL)



struct smbd_server_connection *sconn; /* can be NULL */


So how can I get the client IP?



More specifically
It is in one of the vfs files. I am trying to get the client IP for logging.



static struct vfs_fn_pointers my_vfs = { 
.rename_fn = my_rename
};

static int my_rename(vfs_handle_struct *handle,
const struct smb_filename *smb_fname_src,
const struct smb_filename *smb_fname_dst)
{
//HERE. HOW TO GET THE CLIENT IP FROM *handle OR ANY OTHER METHOD)
}









share|improve this question
























  • That's not possible to answer without more context. What are you doing ? Where in the samba code base are you doing it, and does that part of the code deal with "clients" ?
    – nos
    Nov 21 '18 at 13:44












  • @nos it is in one of the vfs files I am trying to get the client IP for logging. static struct vfs_fn_pointers my_vfs{ .rename_fn = my_rename....}; static int my_rename(vfs_handle_struct *handle, const struct smb_filename *smb_fname_src, const struct smb_filename *smb_fname_dst) {
    – gilo
    Nov 21 '18 at 13:52












  • Well, without more code that shows what you are doing and whether you are doing it in the proper place , I don't see how anyone can help you with this.
    – nos
    Nov 21 '18 at 13:54












  • @nos I added more code to clarify. See the upper part of the original question
    – gilo
    Nov 21 '18 at 13:58


















0














I tried to get the client IP with SAMBA by:



char *client_ip = tsocket_address_inet_addr_string(handle->conn->sconn->remote_address, talloc_tos());


From looking at their source code, I see that sconn can be NULL (and I am getting NULL)



struct smbd_server_connection *sconn; /* can be NULL */


So how can I get the client IP?



More specifically
It is in one of the vfs files. I am trying to get the client IP for logging.



static struct vfs_fn_pointers my_vfs = { 
.rename_fn = my_rename
};

static int my_rename(vfs_handle_struct *handle,
const struct smb_filename *smb_fname_src,
const struct smb_filename *smb_fname_dst)
{
//HERE. HOW TO GET THE CLIENT IP FROM *handle OR ANY OTHER METHOD)
}









share|improve this question
























  • That's not possible to answer without more context. What are you doing ? Where in the samba code base are you doing it, and does that part of the code deal with "clients" ?
    – nos
    Nov 21 '18 at 13:44












  • @nos it is in one of the vfs files I am trying to get the client IP for logging. static struct vfs_fn_pointers my_vfs{ .rename_fn = my_rename....}; static int my_rename(vfs_handle_struct *handle, const struct smb_filename *smb_fname_src, const struct smb_filename *smb_fname_dst) {
    – gilo
    Nov 21 '18 at 13:52












  • Well, without more code that shows what you are doing and whether you are doing it in the proper place , I don't see how anyone can help you with this.
    – nos
    Nov 21 '18 at 13:54












  • @nos I added more code to clarify. See the upper part of the original question
    – gilo
    Nov 21 '18 at 13:58
















0












0








0







I tried to get the client IP with SAMBA by:



char *client_ip = tsocket_address_inet_addr_string(handle->conn->sconn->remote_address, talloc_tos());


From looking at their source code, I see that sconn can be NULL (and I am getting NULL)



struct smbd_server_connection *sconn; /* can be NULL */


So how can I get the client IP?



More specifically
It is in one of the vfs files. I am trying to get the client IP for logging.



static struct vfs_fn_pointers my_vfs = { 
.rename_fn = my_rename
};

static int my_rename(vfs_handle_struct *handle,
const struct smb_filename *smb_fname_src,
const struct smb_filename *smb_fname_dst)
{
//HERE. HOW TO GET THE CLIENT IP FROM *handle OR ANY OTHER METHOD)
}









share|improve this question















I tried to get the client IP with SAMBA by:



char *client_ip = tsocket_address_inet_addr_string(handle->conn->sconn->remote_address, talloc_tos());


From looking at their source code, I see that sconn can be NULL (and I am getting NULL)



struct smbd_server_connection *sconn; /* can be NULL */


So how can I get the client IP?



More specifically
It is in one of the vfs files. I am trying to get the client IP for logging.



static struct vfs_fn_pointers my_vfs = { 
.rename_fn = my_rename
};

static int my_rename(vfs_handle_struct *handle,
const struct smb_filename *smb_fname_src,
const struct smb_filename *smb_fname_dst)
{
//HERE. HOW TO GET THE CLIENT IP FROM *handle OR ANY OTHER METHOD)
}






c samba






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 14:05

























asked Nov 21 '18 at 13:42









gilo

16814




16814












  • That's not possible to answer without more context. What are you doing ? Where in the samba code base are you doing it, and does that part of the code deal with "clients" ?
    – nos
    Nov 21 '18 at 13:44












  • @nos it is in one of the vfs files I am trying to get the client IP for logging. static struct vfs_fn_pointers my_vfs{ .rename_fn = my_rename....}; static int my_rename(vfs_handle_struct *handle, const struct smb_filename *smb_fname_src, const struct smb_filename *smb_fname_dst) {
    – gilo
    Nov 21 '18 at 13:52












  • Well, without more code that shows what you are doing and whether you are doing it in the proper place , I don't see how anyone can help you with this.
    – nos
    Nov 21 '18 at 13:54












  • @nos I added more code to clarify. See the upper part of the original question
    – gilo
    Nov 21 '18 at 13:58




















  • That's not possible to answer without more context. What are you doing ? Where in the samba code base are you doing it, and does that part of the code deal with "clients" ?
    – nos
    Nov 21 '18 at 13:44












  • @nos it is in one of the vfs files I am trying to get the client IP for logging. static struct vfs_fn_pointers my_vfs{ .rename_fn = my_rename....}; static int my_rename(vfs_handle_struct *handle, const struct smb_filename *smb_fname_src, const struct smb_filename *smb_fname_dst) {
    – gilo
    Nov 21 '18 at 13:52












  • Well, without more code that shows what you are doing and whether you are doing it in the proper place , I don't see how anyone can help you with this.
    – nos
    Nov 21 '18 at 13:54












  • @nos I added more code to clarify. See the upper part of the original question
    – gilo
    Nov 21 '18 at 13:58


















That's not possible to answer without more context. What are you doing ? Where in the samba code base are you doing it, and does that part of the code deal with "clients" ?
– nos
Nov 21 '18 at 13:44






That's not possible to answer without more context. What are you doing ? Where in the samba code base are you doing it, and does that part of the code deal with "clients" ?
– nos
Nov 21 '18 at 13:44














@nos it is in one of the vfs files I am trying to get the client IP for logging. static struct vfs_fn_pointers my_vfs{ .rename_fn = my_rename....}; static int my_rename(vfs_handle_struct *handle, const struct smb_filename *smb_fname_src, const struct smb_filename *smb_fname_dst) {
– gilo
Nov 21 '18 at 13:52






@nos it is in one of the vfs files I am trying to get the client IP for logging. static struct vfs_fn_pointers my_vfs{ .rename_fn = my_rename....}; static int my_rename(vfs_handle_struct *handle, const struct smb_filename *smb_fname_src, const struct smb_filename *smb_fname_dst) {
– gilo
Nov 21 '18 at 13:52














Well, without more code that shows what you are doing and whether you are doing it in the proper place , I don't see how anyone can help you with this.
– nos
Nov 21 '18 at 13:54






Well, without more code that shows what you are doing and whether you are doing it in the proper place , I don't see how anyone can help you with this.
– nos
Nov 21 '18 at 13:54














@nos I added more code to clarify. See the upper part of the original question
– gilo
Nov 21 '18 at 13:58






@nos I added more code to clarify. See the upper part of the original question
– gilo
Nov 21 '18 at 13:58














0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53413404%2fsamba-how-to-get-client-ip%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53413404%2fsamba-how-to-get-client-ip%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

404 Error Contact Form 7 ajax form submitting

How to know if a Active Directory user can login interactively

TypeError: fit_transform() missing 1 required positional argument: 'X'