how to use gss_import_name correctly?

╄→尐↘猪︶ㄣ 提交于 2019-12-08 04:53:18

问题


I am using gss_import_name on the client side using GSS_C_NT_HOSTBASED_SERVICE to get a principal like service/server-host@realm.

I am calling like this,

gss_import_name(status, "SERVICE", GSS_C_HOSTBASED_SERVICE, output_name);

But i get the principal like, service/local-machine@realm. From the man page I have learned it internally uses krb5_sname_to_principal to get the hostname, if NULL it takes the localhost name. Now my question is how do pass the correct host name (server-host) to gss-api to create the principal?


回答1:


I overlooked into it. To get the principal in the form 'service/server-host@realm' I should call

gss_import_name(status, "service@server-host", GSS_C_HOSTBASED_SERVICE, output_name);

instead of

gss_import_name(status, "service", GSS_C_HOSTBASED_SERVICE, output_name);

If the host name is missing then it assumes to be the local host name.



来源:https://stackoverflow.com/questions/4179265/how-to-use-gss-import-name-correctly

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!