Dear Sir:
I found xrdp is a great software, it is suitable for rdp centralized management.
I am not a developer and I can't write in C language.

I would like to add a window before landing the authentication window, so 
Imodified the xrdp_wm.c files created xrdp_default_wnd_create alternativemethod 
xrdp_login_wnd_create.
In xrdp_default_wnd.c file I used to save user profile information, verify 
whether the user in the submit button to allow landing, such as 
callxrdp_login_wnd_create success provides a list of servers.

But I call it an error occurred xrdp_login_wnd_create.
I hope you can help me.

////////////////////////////////////////////////////////////////////////////////////////////////

/*****************************************************************************/
int APP_CC
xrdp_wm_default_win_notify(struct xrdp_bitmap* wnd,
                          struct xrdp_bitmap* sender,
                          int msg, long param1, long param2)
{
  struct xrdp_painter* p;

  if (wnd == 0)
  {
    return 0;
  }
  if (sender == 0)
  {
    return 0;
  }
  if (wnd->owner == 0)
  {
    return 0;
  }
  if (msg == 1) /* click */
  {
    if (sender->id == 8) /* ok button */
    {
      if (sender->owner->notify != 0)
      {
        wnd->owner->notify(wnd->owner, wnd, 100, 1, 0); /* ok */
      }
    }
  }
  else if (msg == WM_PAINT) /* 3 */
  {
    p = (struct xrdp_painter*)param1;
        int y=30;
    if (p != 0)
    {
      p->font->color = wnd->wm->black;

      struct xrdp_wm* wm;
      struct xrdp_wm* but;
      struct xrdp_bitmap* edit_u;
      struct xrdp_bitmap* edit_p;
      int i;
      int j;
      char username[256];
      char password[256];

      wm = wnd->wm->login_window;
      edit_u = xrdp_bitmap_get_child_by_id(wm, 2);
      i = g_strlen(edit_u->caption1);
      g_strncpy(username, edit_u->caption1,i);
      edit_p = xrdp_bitmap_get_child_by_id(wm, 4);
      j = g_strlen(edit_p->caption1);
      g_strncpy(password, edit_p->caption1,j);
      xrdp_painter_draw_text(p, wnd, 10, y, "UserName:");
      xrdp_painter_draw_text(p, wnd, 150, y, username);
      y=y+16;
      xrdp_painter_draw_text(p, wnd, 10, y, "Password:");
      xrdp_painter_draw_text(p, wnd, 150, y, password);
      y=y+16;
      struct list* sections;
      struct list* section_names;
      struct list* section_values;
      int fd;
      int ii;
      int jj;
      char* pp;
      char* q;
      char* r;
      char title[256];
      char name[256];
      char pass[256];

      sections = list_create();
      sections->auto_free = 1;
      section_names = list_create();
      section_names->auto_free = 1;
      section_values = list_create();
      section_values->auto_free = 1;

      fd = g_file_open("/etc/xrdp_user.ini");
      file_read_sections(fd, sections);
      for (ii = 0; ii < sections->count; ii++)
      {
        pp = (char*)list_get_item(sections, ii);
        file_read_section(fd, pp, section_names, section_values);
        g_strncpy(title, pp, 255);
        y=y+16;
        if (strncmp(username,title,255) == 0)
        {
          //xrdp_painter_draw_text(p, wnd, 10, y, "find user in xrdp_user.ini");
          //y=y+16;
          xrdp_painter_draw_text(p, wnd, 10, y, title);
          for (jj = 0; jj < section_names->count; jj++)
          {
            q = (char*)list_get_item(section_names, jj);
            r = (char*)list_get_item(section_values, jj);
            if (g_strncmp("name", q, 255) == 0)
            {
              g_strncpy(name, r, 255);
              y=y+16;
              xrdp_painter_draw_text(p, wnd, 10, y, name);
            } else if (g_strncmp("pass", q, 255) == 0)
            {
              g_strncpy(pass, r, 255);
              y=y+16;
              xrdp_painter_draw_text(p, wnd, 10, y, pass);
            }
          }
          if (strncmp(password,pass,255) == 0)
          {
              y=y+16;
              xrdp_painter_draw_text(p, wnd, 10, y, "password == pass");
//#ERROR#
/*
              xrdp_login_wnd_create(wm);
              xrdp_bitmap_invalidate(wm->screen, 0);
              xrdp_wm_set_focused(wm, wm->login_window);
              wm->login_mode = 1;
*/
          }
        }
      }
      g_file_close(fd);
    }
  }
  return 0;
}


[outbind://41/个人签名模板.files/image002.jpg]张敏杰

运维中心・游戏项目管理部
Transport and Maintenance Center ・ Transport and Maintenance Department
巨人网络集团有限公司
Giant Interactive Group, Inc.
中国上海市桂林路396号3号楼4楼
7F 29th Building, 396 Guilin Road XuHui District, Shanghai, PRC 200233
Office: 86 (21) 6451 5001*3311
Fax : 86 (21) 61139920
Email : zhangmin...@ztgame.com



________________________________
声明:
本邮件及其所有附件均属机密信息,并且属于其拥有者、或者受到不得泄漏之保护。如您并非期待之收信者,请您电话或电邮通知其发信者,并从您的系统中删除本邮件及其所有附件;同时您不可以拷贝本邮件或其任何之附件,或将其内容披露至任何他人。如您因任何差错而收到此邮件,请您即刻通知发信人,并即刻删除本邮件及其所有附件。此致谢意。

Notice:
This message and any attachment are confidential and may be privileged or 
otherwise protected from disclosure. If you are not the intended recipient, 
please telephone or email the sender and delete this message and any attachment 
from your system. If you are not the intended recipient you must not copy this 
message or any attachment or disclose the contents to any other person. If you 
have received this transmission in error, please notify the sender immediately 
and then delete all of it. Thank you.
------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
xrdp-devel mailing list
xrdp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xrdp-devel

Reply via email to